-
What kinds of relationships can we represent in a database?
One to one
one to many
many to one
many to many
self referencing. -
When do we use “One to One” relationships? Give an example from the real world.
when there is only 1 of something. Example: user and their personal phone number. -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
Foreign keys are used for all kinds of database relationships. It is used to ensure referential integrity of the data. -
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
courses and their students. -
Give an example from the real world when would need to use a “Many to Many” relationship.
classes and their students -
What does items_orders table do?
It is only used to determine the many to many relationship between the ‘order_id’ table and ‘item_id’ table.
-
What kinds of relationships can we represent in a database? Customer(s) :
*One to One Relationships
*One to Many and Many to One Relationships
*Many to Many Relationships
*Self-Referencing Relationships -
When do we use “One to One” relationships? : When a data entry is equal in ratio 1:1.
Give an example from the real world: If multiple addresses for example belong to only one customer,
this relationship is “One to One”. -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why?
How is it used in order to connect customers to addresses?The customer_id was used to identify customer Number and their address and the relationship between if such.
-
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
Name and Gym Membership id# to check validity of current membership amongst the multiple patrons to use gym services
-
Give an example from the real world when would need to use a “Many to Many” relationship. ? :
*Customers can make many orders.
*Orders can contain many items.
*Items can have descriptions in many languages. -
What does items orders table do ? : creates a “Many to Many” relationship between the items and the orders.
- What kinds of relationships can we represent in a database?
- One to One Relationships
- One to Many and Many to One Relationships
- Many to Many Relationships
- Self-Referencing Relationships
-
When do we use “One to One” relationships? Give an example from the real world.
When there cannot be more then one relationship between an entry. An example is the IBAN number to make deposit directly to a bank account. There can only be one to each. -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
Foreign Keys are used for all kinds of database relationships. It is used to ensure referential integrity of the data. It references the customer to other data for example their address may be on the other table. -
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
Online stores for example, costumer can make different orders and orders can have different items but only one costumer. -
Give an example from the real world when would need to use a “Many to Many” relationship.
Each order can have multiple items and multiple items can be in different orders. -
What does items_orders table do?
Its a Many to many relationship and it relates an item to an order by the id number of each.
1 - One to One / One to Many and Many to One / Many to Many / Self-Referencing
2 - Human and Digital print
3 - It links each customers to its address in order to simplify the information management
4 - One person -> Two or more child
5 - Online store’s products purchased by several customers
6 - It creates relations between items and order (many to many)
Hi everyone,
- One to one, one to many/many to one, many to many, self referencing
- A username and his associated email, assuming for example an app where to create an account you have to choose a username not used by anyone else and you have to link one email not used by anyone else to your account
- It is the foreign key, you take this key, you look it up in the adresses table and you can know the address of the customer. So the key kind of links the customers table and the adresses table
- Customers making orders : one order can only belong to one customer, but one customer can have many orders
- Orders containing items: one item can be in multiple orders, and an order can contain multiple items
- It makes the many to many relationship between items and orders
-
What kinds of relationships can we represent in a database?
One to one, one to many, many to one, many to many and self referencing. -
When do we use “One to One” relationships? Give an example from the real world.
When one row entry in a table can only have ONE specific relationship value in another table as defined by the foreign key, for example, a client’s name and their date of birth. -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
This is the unique identifier, or UID, which can be a foreign key in another table, like the address table. -
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
For example, in a world of customer and product orders, each customer may have zero, one or multiple orders. But an order can belong to only one customer. -
Give an example from the real world when would need to use a “Many to Many” relationship.
Many customers, many orders, one item, that many customers order, many times. -
What does items_orders table do?
The ITEMS_ORDERS table show which types of items are associated to an order. Its purpose here is to create a many-to-many relationship between the 2 preceding tables ORDERS & ITEMS and could even be referencing both as foreign keys. (It is a many to many relationship table).
- we can represent different relationships, like for instance name with address. Name with address and order. Name, address, orders and id number. Those can be one to one or multiple.
- For instance name and telephone number, for example to create a contact registry.
- Customer _ id will help when conducting a join query. This will match more than one field and grouping the results.
- For example to check orders that contain more than one product. Or to check id number of person that orders above 100$ in one or multiple products.
- One orders can include many items, and a particular item can be displayed in many order. If we want to match we need many to many.
- It is a foreign key table, it links two different tables for same reference.
1.) The types of relationships that we can represent in a database are one-to-one, one-to-many/many-to-one, many-to-many, and self-referencing relationships.
2.) We use one-to-one relationships when one field can only belong to one subject. An example of a one-to-one relationship use in the real world would be getting a customer’s order from a grocery store to be sent to their home, where their name can only belong to one home address (their place of residence).
3.) The author of the article has a customer_id column in the customers table because a foreign key (customer_id) is needed to provide a matching record of the customer for relationship use in the next column (adress_id). The foreign key is used in the connection of customers to addresses by providing an address identification number that is associated with a customer identification number (which is a one-to-one relationship in and of itself).
4.) An example from the real world when we would need to use a many-to-one/one-to-many relationship would be when a crypto-trading tax firm needs to find out what kind of transactions a certain citizen (defined by social security identification number) made throughout the previous year on different platforms (attached to a crypto address on each platform they used).
5.) An example from the real world when one would need to use many-to-many relationships would be recording annual car sales between associates at a dealership, and which of those specifically were compacts and which were specifically SUV’s. The sales would be associated with the associate’s employee ID as well as what the model of the car was (which will determine its placing the the compact versus SUV column).
6.) The items_orders table is meant to establish a many-to-many relationship between the items and the orders.
-
ONE TO ONE, ONE TO MANY / MANY TO ONE, MANY TO MANY and SELF-REFERENCING RELATIONSHIPS.
-
Assigning a birth-date to a customer, as an example.
One-to-one relationship, which means that specific identifier belongs to that specific entry. -
In order to be able to assign relationships to that entry. The customer ID represents a ‘foreign key’ within the customer table.
-
One to many e.g. customer with many different orders.
-
Many to many e.g. many orders related to many items, embedded within that orders. Different orders can inherit the same item.
-
A separated table, which is used for establishing relationships between an item and an order by using their ID’s.
- What kinds of relationships can we represent in a database?
- One to One Relationships
- One to Many and Many to One Relationships
- Many to Many Relationships
- Self Referencing Relationships
-
When do we use “One to One” relationships? Give an example from the real world.
One person has a SSN and the SSN can only be attributed to that one person -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
This is the foreign key. FOREIGN KEY constraints enforce referential integrity, which essentially says that if column value A refers to column value B, then column value B must exist. -
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
When someone has an Amazon account. They are the only user of the account, but all the purchases they make are linked back to them. -
Give an example from the real world when would need to use a “Many to Many” relationship.
Students and classes. A student can register to many classes and the classes can include many students -
What does items_orders table do?
The Items_Orders table has only one purpose, and that is to create a “Many to Many” relationship between the items and the orders.
- What kinds of relationships can we represent in a database?
A. One to One Relationships
One to Many and Many to One Relationships
Many to Many Relationships
Self Referencing Relationships - When do we use “One to One” relationships? Give an example from the real world.
A. a) When there is a unique identifier. b) Gym Membership - In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
A. This creates a unique relationship between the client & their address - Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
A. To create relationships between the client and multiple data streams, many orders, many items, many languages - Give an example from the real world when would need to use a “Many to Many” relationship.
A. To create relationship between the items and the orders, list of students and a list of classes, where a class can contain many students and a student may be enrolled in many classes. - What does items_orders table do?
A. Details orders with customer, date and amount. It helps store owner identify which order is made by which customer by using keys: customer_id and order_id.
- What kinds of relationships can we represent in a database?
One to One Relationships, One to Many and Many to One Relationships, Many to Many Relationships, Self Referencing Relationships
- When do we use “One to One” relationships? Give an example from the real world.
A one to one relationship is used when each item is distinctly linked to another item
For example, an individual’s address, phone number, parents, citizenship
- In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
The customer_id is an identifier which is linked to the address, which information can be put in another table
- Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
A shopping website selling various items to multiple different customers can use Many to One / One to many relationship.
Give an example from the real world when would need to use a “Many to Many” relationship.
Business to Business transactions in companies can use Many to Many relationship, whereby a company sell various products to the multiple orders of other business clients, and at the same time buying products from some of their business clients.
- What does items_orders table do?
The items_orders table allows the use to keep track, whereby the different order number can show the items ordered
- One to one, one to many, many to one, many to many and self referencing.
- A unique user and their address.
- The customer id is a foreign key in the customer table. The customer id relates to the customer table where the customer id is a primary key and shows the record of attributes about that specific customer.
- A user could speak many languages. This is a one to many relationship. You can have many languages relating to the attribute of human language. This is many to one.
- Many languages use many letters of the Roman alphabet and there are many Roman letters in the many languages.
- This table relates an item to an order by the id number of each.
-
- one to one
- many to one and one to many
- many to many
- self-referencing
-
a. When an entry belongs to one user
b. A customer and their Passport number -
a. Customer_id is a foreign key used for relating between different tables.
b. It connects the entry in the address table to the customer in the customer table. -
An e-commerce website
-
When you can place multiple orders for multiple items, and when you can order multiples of the same item.
-
It creates many to many relationships.
-
What kinds of relationships can we represent in a database?
One-to-one, one-to-many, many-to-many and self-referencing relationships. -
When do we use “One to One” relationships? Give an example from the real world.
When a single row from one table corresponds to a single row in the second table. For example, a person name and their national ID number. -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
Each table has to have a unique identifier to represent each dataset in a row.
Customer_id column is used as a foreign key (unique identifier of a current table) to connect with foreign keys (unique identifier of referencing table) of other tables through relationships. -
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
One to Many: customers make many orders;
Many to One: many items are contained in a single order. -
Give an example from the real world when would need to use a “Many to Many” relationship.
Many students having several classes. -
What does items_orders table do?
It is used as a junction table to create many-to-many relationships between orders and items table.
1.One to one relationships
One to many and many to on relationships
Many to many relationships
2. When you have an entry that has information that will not need to be linked to any other item. A persons social security number.
3. This allows for the information to be linked or referenced in a program.
4. A receipt where the items sold are associated to one debit card.
5. A warehouse that also tracks where all the parts in the warehouse are used in other products and what order they were associated with.
6. It is used to create a many to many relationship.
- What kinds of relationships can we represent in a database?
- one to one
- one to many
- many to many
- self referring
- When do we use “One to One” relationships? Give an example from the real world.
- when a key value is common in two different tables
college id with name of student
- In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?.
- that costumer_id value will become the keypoint or identifier for other tables.
- Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
my metamask wallet; my single address can point to multiple tokens, to transactions, to staking details, etc
- Give an example from the real world when would need to use a “Many to Many” relationship.
shopping at amazon of an item, it could have multiple vendors, different color or features of the item to purchase, different prices, maybe different dates to deliver per vendor.
- What does items_orders table do?
is making a relationship or become the key between the order_id and item_id
-
What kinds of relationships can we represent in a database?
one to one, one to many, many to one, many to many, self reference -
When do we use “One to One” relationships? Give an example from the real world.
key to value, for example person to address -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
it is a foreign key, a reference to data in another table -
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
customers in an online shop and their order history -
Give an example from the real world when would need to use a “Many to Many” relationship.
table of ordered items in an online shopp. -
What does items_orders table do?
To create many to many relationship between items and orders.
1.)
+) One to One relationships
+) One to Many / Many to One relationships
+) Many to Many relationships
2.) When for a row there will only be 1 value per column in a single table.
Example: heart rate data of an athlete. The heart rate is linked to a certain duration of the run. You don’t link other data to THAT table, even though there can be other tables, like speed or cadence.
3.) This ID can be used as an anchor of that data, to which other parts of the database relate.
4.) Team rosters run by a league administration.
5.) Could be for a logistical hub, where man costumers buy different products to be shipped to them from the hub. But the hub also wants to know, where those customers live, so that they can relate customers in the same region to a specifc container shipment.
6.) It relates the items to the orders in an efficient way, such that an item query can access all the order data behind the order ID.
- What kinds of relationships can we represent in a database?
- One to One Relationships
- One to Many and Many to One Relationships
- Many to Many Relationships
- Self Referencing Relationships
- When do we use “One to One” relationships? Give an example from the real world.
When we have relationship between two tables where each entry from one table is in relationship only to one entry in other table. E.g. User table and Wallet table, where each wallet address can belong to only one user.
- In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
Customer_id is used to index individual customer information. Each customer_id has customer_name and address_id (used as “Foreign Key”), that refers to the matching record in the Address table.
- Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
Each user may have zero, one or multiple wallet addresses. But an wallet address can belong to only one user.
- Give an example from the real world when would need to use a “Many to Many” relationship.
“Many to Many” relationship is used in cases where you need multiple instances on both sides of the relationship. For example, each wallet address can contain multiple assets (tokens). And each asset can also be in multiple wallets.
- What does items_orders table do?
The Items_Orders table has only one purpose, and that is to create a “Many to Many” relationship between the items and the orders.