0% found this document useful (0 votes)
2 views1 page

SQL Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

SQL Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

create table customer (

-> cid int unsigned primary key auto_increment,


-> age int unsigned,
-> address varchar(40),
-> salary decimal(7,2),
-> saldate date default(current_date));

alter table customer auto_increment=101;

create table sales(


-> slno int unsigned primary key auto_increment,
-> saleid int ,
-> cid int unsigned,
-> pname varchar(20),
-> saleqty int unsigned,
-> salerate int ,
-> saledate date,
-> foreign key (cid) references customer(cid)on update cascade on delete
cascade);

alter table customer add column name varchar(30);


insert into customer (name,age,address,salary) values('karthik',35,'delhi',1500),
-> ('kaushik',23,'karnataka',2000),
-> ('charan',25,'Bhopal',6500),
-> ('hardik',37,'Bhopal',8500),
-> ('komal',22,'goa',4500),
-> ('mohan',24,'indore',10000),
-> ('rupali',30,'',5000),
-> ('kashish',28,'karnataka',65000),
-> ('rupali',31,'kolkata',80000);

insert into
sales(saleid,cid,pname,saleqty,salerate)values(10,101,'keyboard',10,600),
-> (11,101,'mouse',15,350),
-> (12,102,'keyboard',15,800),
-> (13,103,'harddisk',10,8000),
-> (14,101,'printer',05,2000),
-> (15,104,'mouse',20,500),
-> (16,105,'mouse',30,250),
-> (17,106,'keyboard',25,600);

You might also like