-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQL Lab-5.txt
126 lines (60 loc) · 2.62 KB
/
SQL Lab-5.txt
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
CREATE TABLE CUSTOMER
(
CUSTOMER_ID NUMBER(7),
FIRST_NAME VARCHAR(15),
MIDDLE_NAME VARCHAR(15),
LAST_NAME VARCHAR(15),
CUSTOMER_ADDRESS VARCHAR(25),
PHONE_NO NUMBER(12),
CUSTOMER_AGE NUMBER(2),
MALE_FEMALE VARCHAR(1),
PURCHASE_DATE DATE,
PRICE NUMBER(10)
)
INSERT INTO CUSTOMER VALUES(111,'POOJA','AKASH','YADAV','GOTRI',9657483921,32,'F','10-JAN-2023',9505)
INSERT INTO CUSTOMER VALUES(632,'GAUTAM','JIGNESH','PATEL',NULL,9612345921,23,'M','12-FEB-2023',87303)
INSERT INTO CUSTOMER VALUES(511,'AARAV','RAVI','SHARMA','FATEHGUNJ',9657233451,21,'M','31-DEC-2022',10005.56)
INSERT INTO CUSTOMER VALUES(401,'RUCHIKA','AVINASH','RANA','AKOTA',9657222321,22,'F','11-JAN-2023',92539)
INSERT INTO CUSTOMER VALUES(331,JIYA','SHIVEN','DAVE','RACECOURSE',8334222921,30,'F','13-NOV-2013',98705.33)
INSERT INTO CUSTOMER VALUES(753,'NEHA','HARSUKH','ASNANI','SUBHANPURA',6345129841,42,'F','10-OCT-2011',65332)
INSERT INTO CUSTOMER VALUES(342,'JIVAN','RAVJI','GADIT','AJWA',9623008921,50,'M','09-SEP-2020',75098)
INSERT INTO CUSTOMER VALUES(876,'NILESH','ASHWIN','MAHESHWARI',NULL,8000231421,44,'M','04-AUG-2015',91004)
INSERT INTO CUSTOMER VALUES(991,'VIJAY','HASMUKH','MISHRA','ALKAPURI',9677733921,39,'M','14-NOV-2022',92000)
INSERT INTO CUSTOMER VALUES(3221,'KINJAL','NAKUL','PATEL',NULL,9235543921,52,'F','08-MAY-2018',88025)
INSERT INTO CUSTOMER VALUES(675,'MINAL','RAKESH','SAHAI',NULL,9211143921,62,'F','21-OCT-2022',98000)
SELECT*FROM CUSTOMER
QUERY3:
SELECT FIRST_NAME||'_'||MIDDLE_NAME||'_'||LAST_NAME AS NAME,CUSTOMER_ADDRESS,PHONE_NO FROM CUSTOMER WHERE CUSTOMER_ADDRESS IS NULL
QUERY4:
SELECT FIRST_NAME||'_'||MIDDLE_NAME||'_'||LAST_NAME AS NAME,CUSTOMER_ADDRESS,PHONE_NO FROM CUSTOMER WHERE CUSTOMER_ADDRESS IS NOT NULL
QUERY5:
UPADTE CUSTOMER SET FIRST_NAME ='RAMESH',LAST_NAME ='CHAWALA' WHERE CUSTOMER_ID IS 675
QUERY6:
QUERY7:
QUERY8:
SELECT FIRST_NAME FROM CUSTOMER WHERE FIRST_NAME LIKE 'P%'
QUERY9:
SELECT FIRST_NAME FROM CUSTOMER WHERE FIRST_NAME LIKE '%K%'
QUERY10:
SELECT FIRST_NAME||'_'||MIDDLE_NAME||'_'||LAST_NAME AS FULL_NAME FROM CUSTOMER
QUERY11:
SELECT UPPER(FIRST_NAME) FROM CUSTOMER
QUERY12:
SELECT LOWER(MIDDLE_NAME) FROM CUSTOMER
QUERY13:
SELECT CURRENT_DATE FROM CUSTOMER
QUERY14:
QUERY15:
QUERY16:
SELECT LENGTH(FIRST_NAME) FROM CUSTOMER
QUERY17:
SELECT COUNT(*) FROM CUSTOMER
QUERY18:
SELECT COUNT(CUSTOMER_AGE) FROM CUSTOMER
QUERY19:
SELECT AVG(CUSTOMER_AGE) FROM CUSTOMER WHERE MALE_FEMALE='F'
QUERY20:
SELECT*FROM CUSTOMER WHERE ROWNUM=1
QUERY21:
QUERY22:
QUERY23;