1.4 Tables Flashcards
Characteristics of a table
A table has a name, a fixed sequence of columns, and a varying set of rows.
What is a column?
A column, also known as an attribute or field, represents a single category of data within a table. Each column contains values of a specific type (e.g., text, numbers, dates) and describes a particular characteristic of the data stored in each row.
What is a row?
A row is an unnamed sequence of values. Each value corresponds to a column and belongs to the column’s data type. Also known as a record or tuple, represents a single, specific entry within a table in a database.
What is a cell?
single column of a single row.
What is an empty table?
A table without rows
What is data independence?
Data independence is a fundamental concept in database management that refers to the separation of data structure from the applications that use the data. This allows changes to be made to the data’s storage or organization without impacting the applications that rely on it.
CREATE TABLE
Creates a new table by specifying the table name, column names, and column data types.
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
DateOfBirth DATE,
Position VARCHAR(100),
Salary DECIMAL(10, 2)
);
DROP TABLE
Deletes a table, along with all the table’s rows, from a database.
DROP TABLE Employees;
ALTER TABLE
The ALTER TABLE statement adds, deletes, or modifies columns on an existing table.
Rename a column
ALTER TABLE table_name
RENAME COLUMN old_column_name TO new_column_name;
Modify a column’s datatype
ALTER TABLE table_name
MODIFY COLUMN column_name new_data_type;
Delete a column
ALTER TABLE table_name
DROP COLUMN column_name;