-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLQuery1.sql
More file actions
39 lines (30 loc) · 825 Bytes
/
Copy pathSQLQuery1.sql
File metadata and controls
39 lines (30 loc) · 825 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
select*from users;
INSERT INTO users (username, password, role, status) VALUES('testing1', 'admin123', 'Cashier', 'Active')
select * from categories;
CREATE TABLE orders
(
id INT PRIMARY KEY IDENTITY(1,1),
customer_id INT NULL,
prod_id VARCHAR(MAX) NULL,
prod_name VARCHAR(MAX) NULL,
category VARCHAR(MAX) NULL,
qty INT NULL,
orig_price FLOAT NULL,
total_price FLOAT NULL,
order_date DATE NULL
)
ALTER TABLE orders
ADD customer_id INT NULL
SELECT * FROM orders
CREATE TABLE customers (
id INT PRIMARY KEY IDENTITY(1,1),
customer_id INT NULL,
total_price DECIMAL(10,2) NULL,
amount DECIMAL(10,2) NULL,
change DECIMAL(10,2) NULL,
order_date DATE NULL
);
SELECT * FROM customers;
ALTER TABLE customers
DROP COLUMN prod_id
SELECT COUNT(id) FROM customers