Untitled
unknown
plain_text
3 years ago
1.2 kB
1
Indexable
CREATE DATABASE CUS create table Customer( cusID int identity (1,1) primary key, name varchar (50) not null, Age int not null check (Age>=18), Adress varchar (200) null, salary decimal (18,2) null ) Insert into Customer(name,Age,Adress,salary) values ('Nahid', 21, 'Gulshan', 2000.00), ('Jahid', 22, 'Mirpur', 2000.00), ('Tonmoy', 21, 'Banani', 2000.00), ('Jui', 20, 'Footpath', 2000.00), ('Jannat', 24, 'Lalbagh', 2000.00), ('Rudra', 27, 'Dhanmondi', 2000.00); create table orders( OrderId int identity (11,1) primary key, CustomerID int not null foreign key references Customer(cusID), Date date null, Amount money null ) insert into orders(CustomerID,Date,Amount) values (1,'2021-02-11',2000), (1,'2021-03-11',2000), (1,'2021-04-11',2000), (1,'2021-05-11',2000) select * from orders select * from Customer where cusID in (select cusID from Customer where salary>4500) select CustomerID from orders where Amount>1200 select name, Adress from Customer where cusID in (select CustomerID from orders where Amount >1200) select Customer.name,Customer.Adress from Customer inner join orders on Customer.cusID= orders.CustomerID and Amount>1200;
Editor is loading...