-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2dml.txt
More file actions
44 lines (24 loc) · 805 Bytes
/
2dml.txt
File metadata and controls
44 lines (24 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
CREATE TABLE customers (
customer_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(100) UNIQUE
);
CREATE TABLE products (
product_id INT PRIMARY KEY,
product_name VARCHAR(100),
price DECIMAL(10, 2),
stock_quantity INT
);
INSERT INTO customers (customer_id, first_name, last_name, email)
VALUES
(1, 'John', 'Doe', 'john.doe@example.com'),
(2, 'Jane', 'Smith', 'jane.smith@example.com');
INSERT INTO products (product_id, product_name, price, stock_quantity)
VALUES
(101, 'Laptop', 800.00, 20),
(102, 'Smartphone', 500.00, 30);
SELECT * FROM customers;
SELECT * FROM products WHERE stock_quantity > 10;
UPDATE products SET price = 850.00 WHERE product_id = 101;
DELETE FROM customers WHERE customer_id = 2;