Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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,

image text in transcribed

[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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago