Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
DROP
ALTERTABLE
TABLESales.Product;
Sales.Product
ADD Supplier INTEGER NOT NULL
CONSTRAINT def_supplier DEFAULT 1;
Create tables using the CREATE TABLE statement
• Specify a table name and column specifications
Modify table definition using the ALTER TABLE statement
• Add or remove columns, constraints, keys
Remove tables using the DROP TABLE statement
• Removes the table from the database
Product
ProductID Name Price Supplier
1 Widget 12.99 1
2 Thingybob 3.75 2
3 Knicknack NULL 1
4 Wotsit NULL 1
!! ERROR !!
SELECT Name,
Name Price
ProductID,
* FROMASProduct;
Product,
Name, Price
FROM Product
Product;
Price * 0.9 AS SalePrice
WHERE Supplier = 2;
FROM Product;
ProductID Name
Product Price
SalePrice Supplier
1 Thingybob
Widget 3.75
12.99
11.691 1
2 Thingybob 3.75
3.375 2
3 Knicknack NULL 1
4 Wotsit NULL 1
Insert data into a table using the INSERT statement
• Specify explicit columns where others support defaults or NULLs
Select data from a table using the SELECT statement
• Specify the columns or expressions you want to return
• Use aliases for column names in the result set
• Use the WHERE clause to filter rows
Creating a Table