0% found this document useful (0 votes)
11 views3 pages

SQL Queries

sql queries for class xii

Uploaded by

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

SQL Queries

sql queries for class xii

Uploaded by

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

I.

Write SQL Queries for the following:

a) Write a Query to create a new database in the Name of “PRACTICALEXAMINATION”.


CREATE DATABASE PRACTICALEXAMINATION
b) Write a query to Open the database “PRACTICALEXAMIANTION”.
USE PRACTICALEXAMINATION
c) Write a query to create the above table called “STUDENT”.
CREATE TABLE STUDENT(NO INTEGER,NAME CHAR(20),DEPT CHAR(10),
ADMN DATE,AGE INTEGER,FEE INTEGER,GENDER CHAR(2));
d) Write a query to display the maximum age of female students from the “STUDENT” table.
SELECT MAX(AGE) FROM STUDENT WHERE GENDER =’F’;
II. Write SQL Queries for the following:

a) Write a query to create the above table called “DOCTOR”.


CREATE TABLE DOCTOR(ID INTEGER,NAME CHAR(20),DEPT CHAR(10),
SEX CHAR(1), EXPERIENCE INTEGER);
b) Display name of all medicine specialists having more than 10 years of experience
from the table DOCTOR.
SELECT NAME FROM DOCTOR WHERE DEPT='MEDICINE' AND EXPERIENCE>10;
c) Display the name of the Doctors who is having first letter as 'L’.
SELECT ID,NAME,EXPERIENCE FROM DOCTOR WHERE NAME LIKE 'L%';
d) Display the number of female doctors
SELECT COUNT(*) FROM DOCTOR WHERE SEX=’F’
III. Write SQL Queries for the following:

a) Write a query to create the above table called “ITEM” .


CREATE TABLE ITEM(CODE INTEGER,INAME VARCHAR(30),QTY INTEGER,
PRICE INTEGER,COMPANY VARCHAR(25), TCODE CHAR(5));
b) To display the details of all the items in ascending order of item names.
SELECT * FROM ITEM ORDER BY INAME;
c) To display item name and price of all those items, whose price is in
the range of 10000 and 22000.
SELECT INAME,PRICE FROM ITEM WHERE PRICE BETWEEN 10000 AND 22000;
d) To display the number of items, which are traded by each trader. The expected output of this
query should be

SELECT TCODE,COUNT(*) FROM ITEM GROUP BY TCODE;

You might also like