SQL KEY CONCEPTS Flashcards
Intro - ch 1
What is a table in a database?
a collection of related data in a database.
- it is made up of rows & columns
Example - A “Customers” table might have columns for customer names, IDs, & contact information.
What is a column in a database?
Is a field in a table that stores specific types of data, such as names or dates.
EXAMPLE - In a “Products” table, there might be a column for “Price” & another for “Description.”
What is a row in a database?
- is a record in a table, containing related data fields for one entry.
*Example** - In a “Customers” table, one row could store the name, ID, & contact information of one customer.
What is a primary key?
- Is a unique identifer for each record in a table.
- No two rows can have the same primary key.
Example - A customer ID number might be a primary key in a “Customers” table.
What is a foreign key?
- is a field in one table that links to the primary key in another table.
- It is used to create relationships between tables.
Examples - In an “Orders” table, a foreign key might link to the “Customers” table using the customer ID.
What are the main SQL commands?
- SELECT: Retrieves data from a database
- INSERT: Adds new data to a table
- UPDATE: Modifies existing data.
- DELETE: Removes data from a table.
- CREATE: Creates new tables or databases.
- DROP: Deletes tables or database.
SELECT
- What is the purpose of SQL commands SELECT?
Retrieves data from a database
INSERT
- What is the purpose of SQL commands INSERT?
Adds new data to a table
UPDATE
- What is the purpose of SQL commands UPDATE?
Modifies existing data.
DELETE
- What is the purpose of SQL commands DELETE?
Removes data from a table.
CREATE
- What is the purpose of SQL commands CREATE?
Creates new tables or databases.
DROP
- What is the purpose of SQL commands DROP?
Deletes tables or database.
Example of table in a database
Example - A “Customers” table might have columns for customer names, IDs, & contact information.
Example of column in a database
EXAMPLE - In a “Products” table, there might be a column for “Price” & another for “Description.”
Example of row in a database
*Example** - In a “Customers” table, one row could store the name, ID, & contact information of one customer.
Example of primary key in a database
Example - A customer ID number might be a primary key in a “Customers” table.
Example of foreign key in a database
Examples - In an “Orders” table, a foreign key might link to the “Customers” table using the customer ID.
What is a table in a database? (In More Detail)
- Define:
- Example:
- Define: A table is a collection of related data in a database. It is made up of rows and columns.
- Example: A “Customers” table might have columns for customer names, IDs, and contact information.
What is a column in a database? (In More Detail)
- Define:
- Example:
- Define: A column is a field in a table that stores specific types of data, such as names or dates.
- Example: In a “Products” table, there might be a column for “Price” and another for “Description.”
What is a row in a database? (In more Detail)
- Define:
- Example:
- Define: A row is a record in a table, containing related data fields for one entry.
- Example: In a “Customers” table, one row could store the name, ID, and contact information of one customer.
What is a primary key? (In more Detail)
- Define:
- Example:
- Define: A primary key is a unique identifier for each record in a table. No two rows can have the same primary key.
- Example: A customer ID number might be a primary key in a “Customers” table.
What is a foreign key? (In more Detail)
- Define:
- Example:
- Define: A foreign key is a field in one table that links to the primary key in another table. It is used to create relationships between tables.
- Example: In an “Orders” table, a foreign key might link to the “Customers” table using the customer ID.