0% found this document useful (0 votes)
43 views

Xii Ip SQL

1. The document describes creating a student1 table with fields Student_id, Name, Gender, Marks. Student_id is the primary key. 2. 10 student records are inserted into the table with details like student ID, name, gender, marks. 3. A series of SQL queries are listed to select, filter, aggregate and order the data in the student1 table.

Uploaded by

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

Xii Ip SQL

1. The document describes creating a student1 table with fields Student_id, Name, Gender, Marks. Student_id is the primary key. 2. 10 student records are inserted into the table with details like student ID, name, gender, marks. 3. A series of SQL queries are listed to select, filter, aggregate and order the data in the student1 table.

Uploaded by

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

CLASS 12th IP - DBMS – MYSQL (Started from Practical Number

20 )

NOTE : You can use your own table name inside your database.

20. Create a student1 table with the Student_id, Name, Gender and
Marks as attributes where the Student_id is the primary key.

‘Student1’ Table Structure

Field Name Data type Attributes

Student_id int(6) or Number Primary key


Name
varchar(30) or Not Null
String
Gender char(4) or Text Not Null
Marks int(3)

SQL CODE

21. Insert the details/records of any 10 new students in the


above table.
(2001, Kamal, Boy, 45)
(2002, Ravi, Boy, 25)
(2003, Nandini, Girl, 43)
(2004, Prasant, Boy, 28)

(2006, Ruchi, Girl, 29)


(2009, Ketaki, Girl, 12)
(2010, Rahul, Boy, 28)
(2011, Ketan, Boy, 21)
(2014, Sajal, Boy, 46)
(2016, Rajni, Boy, 40)

SQL CODE
mysql> insert into student1(student_id,name,gender,marks)

-> values(2001,'kamal','boy',45),

-> (2002,'ravi','boy',25),
-> (2003,'nandini','girl',43),
-> (2004, 'Prasant', 'Boy', 28),
-> (2006,'Ruchi','Girl',29),
-> (2009,'Ketaki','Girl', 12);
-> (2010, 'Rahul', 'Boy', 28),
-> (2011,'Ketan','Boy',21),
-> (2014, 'Sajal', 'Boy',46),
-> (2016,'Rajni','Boy', 40);
Query OK, 10 rows affected (0.02 sec)
Records: 10 Duplicates: 0 Warnings: 0

22. Use the select command to get the details of the students with
marks more than 40.
SQL CODE

23. Show the students record of all Girls students along with their
name.
SQL CODE
24. Find the min, max, sum, and average of the marks field in
student1 table.
SQL CODE

25. Show all the Students whose name started with K. (Example
Ketaki, Ketan etc)
SQL CODE

26. Show all Students whose name ended with i. (Example Ketaki
etc)
SQL CODE
27. Find the total number of records in the table student1.
SQL CODE

28. Show the records of students in the ascending order of marks.


SQL CODE

29. Add one more column ‘Section’ char(1) in the table Student1.
SQL CODE

30. Update only section (A,B,C) column records alternatively in


student1 table.
SQL CODE`

31. Show all the records of students in the ascending order of


Section and marks using Order By.
SQL CODE
32. Find the total number of students in each section in the table
student 1 using group by.
SQL CODE

33. Show the number of students secured marks in between 20


and 30.
SQL CODE

34. Delete the student whose Student who secured marks less
than 22.
SQL CODE

35. Delete the details of a student whose Student_id is 2004 in the


above table.
SQL CODE
36. Find the result of 5 raise to the power 4.
SQL CODE

37. Round of the value 258.7592 up to one place of decimal.


SQL CODE

38. Rounded of the value 658.7362 up to two places of


decimal.
SQL CODE

………………………………………………………………………………………….

******

You might also like