The SQL Create Database Statement
The SQL Create Database Statement
Composite key
create table my_table (
column_a integer not null,
column_b integer not null,
column_c varchar(50),
primary key (column_a, column_b)
);
UPDATE TABLE
UPDATE table_name
SET column1 = value1, column2 = value2...., columnN = valueN
WHERE [condition];
UPDATE customers
SET first_name = 'Judy'
WHERE customer_id = 8000;
UPDATE suppliers
SET supplier_id = 150,
supplier_name = 'Apple',
city = 'Cupertino'
WHERE supplier_name = 'Google';
UPDATE summary_data
SET current_category = (SELECT category_id
FROM products
WHERE products.product_id = summary_data.product_id)
WHERE EXISTS (SELECT category_id
FROM products
WHERE products.product_id = summary_data.product_id);
Delete
DELETE FROM suppliers
WHERE supplier_name = 'Microsoft';
SQL Database
SQL Create DB SQL Drop DB SQL Create Table SQL Drop Table SQL Alter Table SQL
Constraints SQL Not Null SQL Unique SQL Primary Key SQL Foreign Key SQL Check SQL
Default SQL Index SQL Auto Increment SQL Dates SQL Views SQL Injection SQL Hosting