Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
36 views

practical file class 11 (1)

Uploaded by

anijain1275
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

practical file class 11 (1)

Uploaded by

anijain1275
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PRACTICAL

FILE
Subject: INFORMATICS PRACTICES

Code: 065
Data Management: SQL Commands

1. Write a SQL query to create database “Student”.

Ans:- CREATE Database Student

2. Write a SQL query to create “student” table with the student id, class, section,
gender, name, dob, and marks as attributes where the student id is the primary key.
Ans: CREATE TABLE Student ( ID Int primary key,
Class VARCHAR(100),
gender char
name text[20]
Dob date/time
Marks int );

Output:
Table: Student
ID (primary key) CLASS GENDER NAME DOB Marks

3. To insert the details of at least 4 student in the above table Student.


Ans: Insert into Student(ID, Class, Gender, Name, Dob) VALUES (1, 11, ‘M’, ‘Arun’ , 19-02-93, 50);

Insert into Student(ID, Class, Gender, Name, Dob) VALUES (2, 12, ‘M’, ‘Vikas’, 13-02-91, 75);
Insert into Student(ID, Class, Gender, Name, Dob) VALUES (3, 11, ‘F’, ‘Shikha’, 11-03-99, 70);

Insert into Student(ID, Class, Gender, Name, Dob) VALUES (4, 10, ‘M’, ‘Naman’, 12-08-93, 60);

Output:
Table: Student
ID (primary key) CLASS GENDER NAME DOB Marks
1 11 M Arun 19-02-93 50
2 12 M Vikas 13-02-91 75
3 11 F Shikha 11-03-99 70
4 10 M Naman 12-08-93 60

4. To delete the details of a student Vikas in the above table.

Ans: DELETE * from Student where name= “Vikas”;


5. To display the entire content of table on screen.

Ans: SELECT * from Student;

6. To increase marks by 5% for those students, who have Rno more than 20
Ans: UPDATE table Student Set Marks=Marks + (Marks x 5 /100) where ID > 20;

7. To display ID, Name & Marks of those students, who are scoring marks more than 50.
Ans: SELECT ID, Name, Marks from Student where marks> 50;

8. To find the average of marks from the student table.


Ans: SELECT AVG(Marks) from Student.

9. To find the number of students, whose gender are male.


Ans: SELECT COUNT(Gender=’M’) from Student;

10. To add a new column email of appropriate data type.


Ans: ALTER TABLE Student ADD( Email varchar[25]);

11. To find the minimum marks obtained by students


Ans: Select Min (Marks) from Employee.

12. To find the maximum marks obtained by students


Ans: Select Max(Marks) from Employee.

13. To display the information all the students, whose name starts with ‘A’.
Ans: SELECT * from Student where Name Like= “ A%”.

14. To display ID, Name of those students, who are born between ‘1990-01-01’ and
‘2000-01-01’
Ans : SELECT ID, Name from Student BETWEEN (1990-01-01) AND (2000-01-01)

15. To display ID, Name, DOB, Marks of those male students in ascending order of their
names.
Ans: SELECT ID, Name, Dob from Student ORDER by Name;

16. To display ID, Name, DOB, Marks of those male students in descending order of their
names.
Ans: SELECT ID, Name, Dob from Student ORDER by Name desc;

You might also like