DBMS ass
DBMS ass
DBMS assignment-2
Student
create table stude__ (Roll_No int primary key , Fname char(20) not
null , Lname char(20) not null , Sname char(20) not null , dept_no
int references dept__(dept_no) , semester int , contact_no
number(10) unique , gender char(10));
dept.
create table dept__(dept_no int primary key , dept_name
varchar(20) not null);
sql query
1. Display the first name and contact number of all students.
DBMS assignment – 3
1. From the following table, write a SQL query to find the details of those
salespeople who come from the 'Paris' City or 'Rome' City. Return
salesman_id, name, city, commission.
2. From the following table, write a SQL query to retrieve the details of all
customers whose ID belongs to any of the values 3007, 3008 or 3009.
Return customer_id, cust_name, city, grade, and salesman_id.
3. From the following table, write a SQL query to find salespeople who
receive commissions between 0.12 and 0.14 (begin and end values are
included). Return salesman_id, name, city, and commission. Sample
table: salesman
4. From the following table, write a SQL query to retrieve the details of
the salespeople whose names begin with any letter between 'A' and 'L'
(not inclusive). Return salesman_id, name, city, commission.
select sal_id , sal_name , city , commission from salesman where
sal_name between 'a%' and 'l%';
5. From the following table, write a SQL query to calculate total purchase
amount of all orders. Return total purchase amount. Go to the editor
7. From the following tables, write a SQL query to locate all the customers
and the salesperson who works for them. Return customer name, and
salesperson name.
8. From the following tables write a SQL query to find the salesperson and
customer who reside in the same city. Return Salesman, cust_name
and city.
9. From the following tables, write a SQL query to find all salespeople and
customers located in the city of London
10. From the following table, create a view for all salespersons.
Return salesperson ID, name, and city.