1.

38. Write command and queries to create and manipulate the records of a table named 'Students' with the following fieldsRoll_NoNameClassMarks101AjayХ765107SurajIX865109SimranX766103AmanIX821104NareshIX1a.Write SQL commands to create the above-given table. Set appropriate datatypes for the fields.b. Write a query to display the details of all the students studying in class X.Write the query to change the Roll_No of the student named Aman to 106.d. Write a query to delete the record where the value of Marks is 1.C.​

Answer»

a) #creating the table

Create table Students(Roll_No ch‎ar(3) Primary Key, Name varch‎ar(30), CLASS ch‎ar(2), Marks int);

#inserting the records

Insert into Students values(101, 'Ajay', 'X', 765);

Insert into Students values(107, 'Suraj', 'IX', 865);

Insert into Students values(109, 'Simran', 'X', 766);

Insert into Students values(103, 'Aman', 'IX', 821);

Insert into Students values(104, 'Naresh', 'IX', 1);

b) #to display the details of all the students studying in class X.

Select * from Students where Class = 'X';

c) #to change the Roll_No of the STUDENT named 'Aman' to 106.

Update Students set Roll_No = 106 where Name = 'Aman';

d) #to DELETE the record where the value of Marks is 1.

Delete from Students where Marks = 1



Discussion

No Comment Found