You are on page 1of 9

Q1.Mr.

Ramdin runs his medical store and he created table STORE


with Ayurvedic Medicines. Write SQL commands for (i) to (iv) and
output for (v)

Ans.
(i) To display name of all the medicines type syrup

(ii) To display names of all medicines by the manufacture


Dindayal
(iii) To show the price of the medicine name in descending order
of their price

(iv) To add a new row for product with the details: E4992, Kaya
Kalp, Patanjali, Churna, 1" Dec 2002, 31" march 2006, 60

Ans. insert into store (batchno, medicine_name, company,


type, DOM, DOE, price) values ("E4992", "kaya
kalp","patanjali", "churna", "2002/12/1","2006/3/31",60);

(v) Select *from store where company like “%an%”


Q2. Write an SQL query to create the table SalesPerson with the
following structure?

Ans. create table salesperson (snum int(6) primary key, sfname


varchar(15) not null, slname varchar(12), city varchar(15), sales
double (9,2), comm double (8,2));

Q3.
Ans. (i) To display the detail of the coaches whose age is greater
than 40

(ii) To display the coaches name, the game with highest pay

(iii) To to display coach_ID, coach name and date of appointment in


descending order
Q4.Based on table STUDENT given here, write suitable SQL queries
for the following:

1. Write a SQL command to display name and stream from given


table?
2. Write a SQL command to display details of students whose
average is more than 70.

3. Write a SQL command to display name and stream arranged in


ascending order of stream.

4. Write a SQL command to display name and optional where


optional is not maths?
5. Write a SQL command to display details of students whose name
contains “I” in it.

6. To display details of students whose optional is null.

7. To display details of students whose stream ends with “ce”.


8. To display name ,stream and percent of students whose stream is
ip and marks are equals to 60

3. Write SQL command to –


(a) create the following table

Ans. create table job(custid int(4) primary key ,custname


varchar(25),balance decimal(5,2) not null,creditlimit int(8),sno
int(2));
1.To add/insert the given record in table job.
Ans.
insert into job(custid,custname,balance,creditlimit,sno) values
(1,"Rahul",100.00,100000,101);

3.To Delete the record of customer whose name is ‘BOB’


Ans.
delete from job where custname="bob";

4. To Show custid, custname and balance sorted by customer name.

5. To Display the structure of the table.

6. To display all the record of the customers whose credit limit is


greater than 25000

You might also like