-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLQuery3.sql
More file actions
37 lines (27 loc) · 929 Bytes
/
SQLQuery3.sql
File metadata and controls
37 lines (27 loc) · 929 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
create table Testdb
(
order_id integer,
order_date date,
product_name varchar(100),
total_price decimal(6,2),
payment_method varchar(20)
);
--delete a table
--drop table amazon_orders;
--DML -> data Manipulation language
insert into Testdb values(1,'2022-10-01','Baby Milk',30.5,'UPI');
insert into Testdb values(2,'2022-10-02','Baby Powder',130,'Credit Card');
insert into Testdb values(3,'2022-10-01','Baby cream',30.5,'UPI');
insert into Testdb values(4,'2022-10-02','Baby soap',130,'Credit Card');
--to delete data
delete from Testdb ;
--SQL--> structured query language
-- DQL -> data querying language
select * from Testdb ;
--limiting columns or selecting specific columns
select product_name,order_date,total_price from Testdb ;
--limiting rows
select top 1 * from Testdb ;
--data sorting
select * from Testdb
order by order_date desc,product_name desc,payment_method;