SAMPLE PAPER
XI - INFORMATICS PRACTICES
Time: 1 hr 30 min MM: 30
Note: All questions are compulsory. Marks are indicated before questions.
Which command is used to list the structure of a table? (½)
What is the purpose of ALTER TABLE command? (½)
What is the difference between DDL and DML? Explain with an example. (1)
What is Foreign Key? Define with an example. (1)
Give the examples of character functions. (1)
Give the examples of numeric functions. (1)
Write SQL commands to create the table COLLEGE with following specifications. (7)
| Field Name | Data Type | Constraints |
| Cno | Int(4) | Primary Key |
| Name | Varchar(20) |
|
| Age | Int(2) | Default 18 |
| Department | varchar(15) |
|
| Dateofadm | date |
|
| Fees | Double(7,2) |
|
| Gender | Char(1) |
|
Write SQL commands to insert 5 records in COLLEGE table.
Write SQL command to insert default age.
Add one more column Address of type char (20) in the COLLEGE table.
Modify the column Address as char (25).
Insert address in first record of COLLEGE table.
Change the name of the column Address to Home_Address.
Create a new table StudentDetail with Name,Age & Gender fields from COLLEGE table.
Remove the Primary Key from COLLEGE TABLE.
Delete all the tuples of COLLEGE table.
Delete the last attribute of COLLEGE table.
Delete the College table.
What is the purpose of WHERE clause?
What is the purpose of DISTINCT clause?
What is column alias?
Write SQL commands to the HOSPITAL table. (5)
TABLE: HOSPITAL
| No | Name | Age | Department | Dateofadm | Charges | Gender |
| 1 | Arpit | 62 | Surgery | 1998-01-21 | 300 | M |
| 2 | Zarina | 22 | ENT | 1997-12-12 | 250 | F |
| 3 | Kareem | 32 | Orthopedic | 1998-02-19 | 200 | M |
| 4 | Arun | 12 | Surgery | 1998-01-11 | 300 | M |
| 5 | Zabed | 30 | ENT | 1998-01-12 | 250 | M |
| 6 | Ketaki | 16 | ENT | 1998-02-24 | 250 | F |
| 7 | Ankita | 29 | Cardiology | 1998-02-20 | 800 | F |
| 8 | Zareen | 45 | Gynecology | 1998-02-22 | 300 | F |
| 9 | Kailash | 19 | cardiology | 1998-01-13 | 800 | M |
| 10 | Shilpa | 23 | Nuclear Medicine | 1998-02-21 | 400 | F |
To select all the information of patients of cardiology department.
To list the names of female patients who are in ENT department.
To list names of all patients with their date of admission in ascending order.
To display Patient's Name, Charges, Age of only male patients.
To count the number of patients with Age<30.
To insert a new row in the HOSPITAL table with the following data:
11,'Aftab',24,'Surgery','1998-02-25',NULL,'M'
To display all the patients whose charges are NULL.
To list position of character 'a' in the names of patients.
To display first three characters of the patient name.
Change age & charges of Kailash to 21, 1000 respectively.
Given the following EMPLOYEE relation. Write SQL command. (13)
TABLE: EMPLOYEE
-
ENO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPT
7369
Sunita Sharma
CLERK
7902
1980-12-17
2800
NULL
20
7499
Ashok Singhal
SALESMAN
7698
1981-02-20
3600
300
30
7521
Rohit Rana
SALESMAN
7698
1981-02-22
5250
500
30
7566
Jyoti Lamba
MANAGER
7839
1981-04-02
4975
NULL
20
7654
Martin S.
SALESMAN
7698
1981-09-28
6250
1400
30
7698
Binod Goel
MANAGE
7839
1981-05-01
5850
NULL
30
7782
Cheten Gupta
MANAGER
7839
1981-06-09
2450
NULL
10
7788
Sudhir Rawat
ANALYST
7566
1987-04-19
5000
NULL
20
7839
Kavita Sharma
PRESIDENT
NULL
1981-11-17
5000
NULL
10
7844
Tushar Tiwari
SALESMAN
7698
1981-09-08
4500
0
30
7876
Anand Rathi
CLERK
7788
1987-05-23
6100
NULL
20
7900
Jagdeep Rana
CLERK
7698
1981-12-03
4950
NULL
30
7902
Sumit Vats
ANALYST
7566
1981-12-03
3500
3600
20
7934
Manoj Kaushik
CLERK
7782
1982-01-23
5300
NULL
10
To display the employee name and the incremented value of SAL as SAL+300.
To list the employee name and his annual salary (Annual salary=12*sal+100).
Display the ename and sal where comm is NULL.
To list the unique jobs from the table.
To list the salary where salary is less than the commission.
To list the mgr which are in 7902, 7566, 7788.
To list all the columns in the ascending order of deptno and descending order of salary.
To display the employee name and job of employees hired between Feb 20, 1981 and May 1, 1981.
Display the ename and deptno of all employees in department 20 and 30 in alphabetical order.
To list the name and salary of all the employees who earn more than 1200 and are in department 10 or 40.
To list all the employees who do not have manager.
To list name and salary of all employees who earn commissions.
To list the names of all employees where the second letter of their name is an 'a'.
Write the output of the following:
SELECT LEFT(ENAME,4), COMM+SAL*20 FROM EMPLOYEE WHERE ENAME='Ashok Singhal';
SELECT ENAME FROM EMPLOYEE WHERE ENAME LIKE 'a%';
SELECT AVG(SAL),MAX(SAL),MIN(SAL),SUM(SAL) FROM EMPLOYEE WHERE JOB LIKE 'SALES%';
SELECT COUNT(COMM) FROM EMPLOYEE WHERE DEPT=20;
SELECT DEPT, MAX(SAL) FROM EMPLOYEE GROUP BY DEPT HAVING MAX(SAL)>2900;
SELECT CONCAT('Nimawat',NULL,'School');
SELECT SUBSTR('OurIndia',4,3);
SELECT TRIM(' INDIA ');
SELECT MOD(99,2);
SELECT ROUND(-2578.78,1);
SELECT TRUNCATE(1.865,1)+SQRT(169);
SELECT SUBSTR(TRIM(' INDIA IS GREAT '),3,9);
Write a SQL function to remove trailing # character from a given expression.
P='NITIN#KUMAR##########'

question is typical but who uses his mind he can do it ..............
ReplyDelete