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.