Skip to content

Commit 05867d7

Browse files
committed
creating customer database
1 parent 6290863 commit 05867d7

File tree

3 files changed

+295
-0
lines changed

3 files changed

+295
-0
lines changed

airthmatic.sql

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
select 5-6 as substarction, 5+5 as addition ,5*6 as multiplication , 20/2 as division;
2+
3+
select 5>6 as greaterthan;
4+
select 5<6 as lessthan;
5+
6+
select 9 >= 10 as lessthanequalto;
7+
8+
select 25=25 as comparetwovalues;
9+
10+
select 5=6 && 1=2 as result;
11+
12+
select 5=5 AND 1=1 as result , 5=5 OR 1=2 as result;
13+
14+
select !0 as result , !1 ;
15+
16+
17+
18+

customer.sql

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
create database CUSTOMER;
2+
create table customer_details(
3+
CUSTOMER_IDcustomer_detailscustomer_detailscustomer_details int ,
4+
CUSTOMER_Name varchar(15),
5+
CUSTOMER_Number bigint,
6+
CUSTOMER_Address varchar(200)
7+
8+
);
9+
select * from customer_details;
10+
11+
desc customer_details;
12+
13+
create table customer_order(
14+
customer_order_ID int,
15+
customer_order_Name varchar(15),
16+
customer_order_Price double
17+
18+
);
19+
20+
select * from customer_order;
21+
22+
desc customer_order;
23+
show columns from customer_order;
24+
25+
create table customer_transaction(
26+
transaction_Id int ,
27+
transaction_Time time unique,
28+
transaction_Amount double check (transaction_Amount>1),
29+
transaction_Type varchar(10) not null,
30+
transaction_status boolean,
31+
primary key (transaction_Id)
32+
);
33+
desc customer_transaction;
34+
35+
alter table customer_transaction modify transaction_status boolean default false;
36+
desc customer_transaction;
37+
alter table customer_transaction modify transaction_status varchAR(20) default false;
38+
desc customer_transaction;
39+
alter table customer_transaction add transaction_Addreses varchAR(20) not null;
40+
alter table customer_transaction drop transaction_Addreses;
41+
desc customer_transaction;
42+
show tables;
43+
44+
create table product(
45+
product_id int,
46+
product_Name varchar(15),
47+
product_price double,
48+
primary key (product_id)
49+
);
50+
show tables;
51+
select * from product;
52+
drop table product;
53+
create database student;
54+
55+
drop database student;
56+
57+
alter table product rename to product_Details;
58+
alter table product_details rename column product_price to productPRice;
59+
desc product_details;
60+
alter table product_details rename column product_price to product_Price;
61+
insert into product_details (product_id,product_Name,productPRice) values (1,'tv',15000.0);
62+
insert into product_details (product_id,product_Name,productPRice) values (2,"watch",4500.0);
63+
insert into product_details (product_id,product_Name,productPRice) values (3,'MObile',10000.0);
64+
-- insert into product_details values (4,'Bike',450000.0),(5,'Sanitizer',50);
65+
insert into product_details (product_id,productPRice) values (5,15000.0);
66+
select * from product_details;
67+
68+
-- delete the table records ------------------------------
69+
truncate product_details;
70+
select * from product_details;
71+
-- --------------------------------------------------------
72+
73+
74+
75+
76+
77+
78+
79+

sql.txt

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
SQL :
2+
Data -->
3+
DataBase -->
4+
RDBMS --->
5+
DT----------------------------
6+
integer- BigINT,smallInt,int , tiny int -->127 to -128
7+
String - Character -->size[255]
8+
integer+String-> Address-->VarChar size[255]
9+
integer+String-> text -->n number of lines
10+
folating-------> float,double,decimal
11+
boolean--------> true , false
12+
13+
Date -----------> date,datetime,time,timestamp
14+
---------------------------------
15+
Opeartions
16+
Airthmatic
17+
comparative /relatives ope
18+
logical--And -(both) OR--(one) NOT ()
19+
AND -----both side will be true--0
20+
OR ------One side will be true --1
21+
22+
SCHEMAS ---it is collection of DATABASE
23+
Database --
24+
logical structure ---tables ,database
25+
phyical structure ---size , memory
26+
27+
28+
keywords
29+
30+
fasle---0
31+
true---1
32+
33+
declarative ---how to do not saying what to do
34+
35+
Types of commands
36+
create ---database ,tables
37+
database
38+
syntax : - create database databaseName;
39+
tables
40+
create table tablename(
41+
//query
42+
43+
);
44+
45+
46+
example: create database customer;
47+
48+
create table customer_Details(
49+
customer_ID int ,//int size defaultt 11
50+
customer_name varchar(15)//name should be less than 15 character
51+
customer_number bigint,
52+
customer_Address varchar(200)
53+
);
54+
select * from customer_details;//tables view
55+
desc customer_details;//table description
56+
show columns from customer_order;//columns
57+
constraint //not null
58+
keywords/rule to write
59+
unique----id should be
60+
61+
check ----restrict the timings
62+
condition, check age >18
63+
64+
primary key-- combination of is not null and unique
65+
66+
foreign key --parent to child (any properties u can make it as primary key)
67+
68+
alter--->it is change the structure of the table
69+
70+
modify---
71+
alter table customer_transaction modify transaction_status boolean default false;
72+
73+
add----
74+
alter table customer_transaction add transaction_Addresee varchAR(20) not null;
75+
76+
drop-----
77+
alter table customer_transaction drop transaction_Addreses;
78+
desc---
79+
desc customer_transaction;
80+
81+
11/04/2021
82+
Administartive commonds
83+
show databases it wil show the all database name
84+
show tables
85+
DDL -- data defination language -----create ,alter,drop,
86+
DML -- data manipulation language ---insert,
87+
88+
reaname table
89+
alter table product rename to product_Details;
90+
rename column name
91+
alter table product_details rename column product_price to productPRice;
92+
truncate
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+
127+
128+
129+
130+
131+
132+
133+
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
144+
145+
146+
147+
148+
149+
150+
151+
152+
153+
154+
155+
156+
157+
158+
159+
160+
161+
162+
163+
164+
165+
166+
167+
168+
169+
170+
171+
172+
173+
174+
175+
176+
177+
178+
179+
180+
181+
182+
183+
184+
185+
186+
187+
188+
189+
190+
191+
192+
193+
194+
195+
196+
197+
198+

0 commit comments

Comments
 (0)