The following questions are based ALTER statement.
1.Create a table with name “employee”. The table having two attributes “empid” accepts integers and “name” accepts a string of maximum length ’10’.
2.Print the schema of your table. It should be something like this.
3.Insert the following records in to the table.
4.Print the total data present in the table. your output should be something like this.
5.Print the ’empid’ column in descending order. your output should be something like this.
6.Add a new column ‘description’ to the above table and print the schema of the table. your output should be something like this. The datatype of the description is ‘text’ type.
7.Insert one more record with name “Ramana”, print the data in the table.
1003 : ” The Full name of the Employee is T. V Rathnam and His designation is Assistant Professor”.
8.Print the description of employee 1003.
9.Insert a new field ‘gender’ in between ‘name’ and ‘description’ attributes. This field accept only one character.
print the schema and it is something like this.
10.Insert a new field “Branch” as a first column. It should accepts 10 variable length characters.
Print the schema now and it is something like this.
11.Change the definition of the ‘name’. i.e. increase size limit of the name up to ’20’ characters.
Print the schema again and it is something like this.
12.Remove the column “branch” from the table.
13.Add two attributes “location” and “designation” at the end. Do this in a single statement. Your schema should be shown here.
14.Now drop the columns “location” and “designation”.
15.Update the ’empid’ with primary key.
16.Rename the ’empid’ to ’employee_id’. print the schema and it should be like this.
17.Change the table name ’employee’ to ’employee_details’.
18.Print the details of ’employee’ table.
19.Print the details of ’employee_details’.
20.Delete the complete data present in the table, but not the schema. For example if you use
select * from employee_table
it prints empty set.
when you print the schema, your output should be something like this.