CREATE TABLE statements create a new table in the database.
8. ALTER TABLE — modifies a table
ALTER TABLE table_name
ADD column_name datatype;
ALTER TABLE statements add, delete, or modify columns in an
existing table.
9. DROP TABLE — deletes a table
DROP TABLE table_name;
DROP TABLE statements drop an existing table in a database.
10. CREATE INDEX — creates an index
CREATE INDEX index_name
ON table_name (column_name1, column_name2…); Index statements create on existing tables to retrieve the rows quickly.
11. DROP INDEX — deletes an index
ALTER TABLE table_name
DROP INDEX index_name;
DROP INDEX statements delete an index in a table.
Q: Create a database name students.
Create table name Student_details(Sl.no Integer(2), Name Varchar(30), Course varchar(20), Roll_no varchar(15), DOB(Date));
INSERT INTO Student_details VALUES (1,'LOKESH','MCA',1CD23mc001,’12-01-
1999’); 10 students data you have to insert 5 MBA and 5 MCA.
Solve these questions:
Show only MCA students. Update 1 student from MBA to MCA. Alter column from Course to Degree. Add new column Marks after Degree column. Update the marks of all 10 students.