Question: [Q.2] Answer the following questions. [18 points] (a) Write two SQL statements to create a database (or schema) simpleCo if the database does not exist,

 [Q.2] Answer the following questions. [18 points] (a) Write two SQL

[Q.2] Answer the following questions. [18 points] (a) Write two SQL statements to create a database (or schema) simpleCo if the database does not exist, and use simpleCo. (b) Drop tables employee and department from the simpleCo if the tables exist in the simpleCo schema. (c) Write a SQL statement to create a table department as described below. Type Key Default deptid tinyint(4) varchar(40) YES (d) Write a SQL atement to alter Dname column type from varchar(40) to varchar(30), not NULL, and default value to empty string (i.e, ') as shown below. Field Null NULL NO PRI NULL Dname Null Key Extra Default NULL Field deptid dname Type tinyint(4) varchar(30) PRI NO NO 1 (e) Write a SQL statement to populate department table as shown below. deptid Dname Research Human Resource Sales (f) Write a SQL statement to create employee table as shown below. Note dno in employee is foreign key referencing deptId in the department table. Your SQL statement to create employee table should include a foreign key constraint named fk_etod for adding the foreign key constraint. 2 3 Null Extra Key PRI Default NULL NO NULL Field employeeld Fname Lname salary dno Type char(9) varchar(20) varchar(20) decimal(10,2) tinyint(4) NO NO NULL NULL NO YES MUL NULL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!