Term
What are the four Column Constraints? |
|
Definition
PRIMARY KEY constraint can be used to uniquely identify the row.
UNIQUE columns have a different value for every row.
NOT NULL columns must have a value.
DEFAULT assigns a default value for the column when no value is specified. |
|
|
Term
What is CREATE TABLE used for? |
|
Definition
The CREATE TABLE statement creates a new table in a database. It allows one to specify the name of the table and the name of each column in the table. |
|
|
Term
What is the syntax for CREATE TABLE? |
|
Definition
CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype ); |
|
|
Term
What is the INSERT INTO statement used for? |
|
Definition
The INSERT INTO statement is used to add a new record (row) to a table.
It has two forms:
Insert into columns in order. Insert into columns by name. |
|
|
Term
What is the syntax for INSERT INTO? |
|
Definition
-- Insert into columns in order: INSERT INTO table_name VALUES (value1, value2);
-- Insert into columns by name: INSERT INTO table_name (column1, column2) VALUES (value1, value2); |
|
|
Term
What is ALTER TABLE used for? |
|
Definition
The ALTER TABLE statement is used to modify the columns of an existing table. When combined with the ADD COLUMN clause, it is used to add a new column. |
|
|
Term
What is the syntax of ALTER TABLE? |
|
Definition
ALTER TABLE table_name ADD column_name datatype; |
|
|
Term
What is a DELETE FROM statement used for? |
|
Definition
The DELETE statement is used to delete records (rows) in a table. The WHERE clause specifies which record or records that should be deleted. If the WHERE clause is omitted, all records will be deleted. |
|
|
Term
What is the syntax of the DELETE FROM statement? |
|
Definition
DELETE FROM table_name WHERE some_column = some_value; |
|
|
Term
What is an UPDATE statement used for? |
|
Definition
The UPDATE statement is used to edit records (rows) in a table. It includes a SET clause that indicates the column to edit and a WHERE clause for specifying the record(s). |
|
|
Term
What is the syntax for the UPDATE statement? |
|
Definition
UPDATE table_name SET column1 = value1, column2 = value2 WHERE some_column = some_value; |
|
|