int,unit_price int,muf_date date,exp_date int, sid varchar(77) foreign key references Sale_persons (sid) on delete cascade on update cascade, cid char(22)foreign key references customer(cid) on delete cascade on update cascade)
select * from Sale_persons
insert into Sale_persons values('S01','Abdi','kenesa','keneni','m',1990,'Accounting',3432,2021,+2511945 51) insert into Sale_persons values('S02','Chaltu','kuma','Damasa','f','1992','marketig',3732,'2021', +25112321) insert into Sale_persons values('S03','Bekele','Hika','kadir','m',1994,'Economics',4232,2022,+25192551) insert into Sale_persons values('S04','Sifan','keresa','mamud','f',1998,'Economics',5632,2019,+2512551) insert into Sale_persons values('S05','Rome','Endale','Bona','F',1990,'supply',4732,2020,+25134551)
select * from login
insert into login values('Abdi','abdik','standard','s01','s01') insert into login values('chaltu','chaltu','admin','s02','s02')
select * from customer
insert into customer values('c002','bontu','keneni','f','adama',+251985653) insert into customer values('c004','Fayisa','Tullu','m','ambo',+251987653) insert into customer values('c003','Kedir','Tola','m','nekemte',+251989653) insert into customer values('c005','Yosen','Endale','f','Bushoftu',+251987653)
select * from product
insert into product values('m101','Buskuit',1,35,'2020',2021,'S01','c002') insert into product values('m102','candy',2,15,'2021',2022,'S02','c004') insert into product values('m103','colgate',4,50,'2020',2021,'S03','c003') insert into product values('m104','Brush',3,25,'2021',2022,'S04','c005') insert into product values('m105','cake',4,75,'2022',2023,'S05','c002')
select pname,cfname+' '+cmname 'C_name',sum(unit_price)'total price' from
product p,customer c on (c.cid= p.cid) SELECT customer.cfname+' '+ customer.Cmname'c_Name', product.pname, sum(product.unit_price) FROM customer INNER JOIN product ON customer.cid = product.cid group by customer.cfname,customer.Cmname,product.pname
sum(product.unit_price) FROM customer INNER JOIN product ON customer.cid = product.cid group by customer.cfname,customer.Cmname,product.pname
update Sale_persons set salary =salary +salary*0.2 where salary >4000
select fname+' '+ mname+' '+lname as full_name,sex,occupation from Sale_persons where sex='f' and occupation ='supply' or occupation='marketing' select COUNT(*),min(salary),MAX(salary),AVG(salary),SUM(salary) from Sale_persons SELECT product.pname, customer.city, count(product.quantity) FROM customer INNER JOIN product ON customer.cid = product.cid group by pname,city,quantity having product.quantity >=3 select top 3 salary ,fname+' '+ mname+' '+lname as full_name,occupation,sum(salary) from Sale_persons group by fname,mname,lname ,occupation,salary order by salary desc