4-Data Manipulation and Querying
4-Data Manipulation and Querying
AND QUERYING
DATA MANIPULATION AND
QUERYING
CREATE
INSERT
UPDATE
DELETE
TO CREATE A TABLE
A shorter way
CREATE TABLE order (
order_no integer PRIMARY KEY,
quantity integer,
product_no integer REFERENCES product (product_no));
If the column names are the same in both the table which contains the
primary key and the one that references that key as a foreign key, you can
use shorthand to specify this fact
If you don’t have values for columns you can omit. The default
value will be filled in or null if no user-defined defaults are
specified
INSERT INTO product (product_no, name) VALUES (1, ‘cheese’);
You can insert multiple rows into a table
Specify conditions
UPDATE product SET price = 10 WHERE price = 5;
CREATE
INSERT
UPDATE
DELETE