0% found this document useful (0 votes)
53 views1 page

Student List

The document contains SQL commands to manage a 'Student_list' table. It includes dropping the existing table, creating a new one with specified columns, inserting multiple records (some with duplicate entries), and committing the changes. Finally, it retrieves all records ordered by roll number and student name.

Uploaded by

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

Student List

The document contains SQL commands to manage a 'Student_list' table. It includes dropping the existing table, creating a new one with specified columns, inserting multiple records (some with duplicate entries), and committing the changes. Finally, it retrieves all records ordered by roll number and student name.

Uploaded by

kravishind
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-- Drop the existing table if it exists

DROP TABLE Student_list;

-- Create a new table named "Student_list" with columns "roll_no" and "stu_name"
CREATE TABLE Student_list (
roll_no NUMBER,
stu_name VARCHAR2(30)
);

-- Insert records into the table


INSERT INTO Student_list (roll_no, stu_name) VALUES (1, 'KING');
INSERT INTO Student_list (roll_no, stu_name) VALUES (1, 'KING');
INSERT INTO Student_list (roll_no, stu_name) VALUES (2, 'BLAKE');
INSERT INTO Student_list (roll_no, stu_name) VALUES (3, 'CLARK');
INSERT INTO Student_list (roll_no, stu_name) VALUES (4, 'JONES');
INSERT INTO Student_list (roll_no, stu_name) VALUES (5, 'SCOTT');
INSERT INTO Student_list (roll_no, stu_name) VALUES (5, 'SCOTT');
INSERT INTO Student_list (roll_no, stu_name) VALUES (6, 'RAGHU');
INSERT INTO Student_list (roll_no, stu_name) VALUES (7, 'FORD');
INSERT INTO Student_list (roll_no, stu_name) VALUES (7, 'FORD');
INSERT INTO Student_list (roll_no, stu_name) VALUES (8, 'SMITH');
INSERT INTO Student_list (roll_no, stu_name) VALUES (9, 'ALLEN');
INSERT INTO Student_list (roll_no, stu_name) VALUES (10, 'WARD');

-- Commit the changes


COMMIT;

-- Retrieve all records from the table, ordered by roll number and student name
SELECT *
FROM Student_list
ORDER BY roll_no, stu_name;

You might also like