Question

If you had to create a new table in your database called EMPLOYEE and load data...

If you had to create a new table in your database called EMPLOYEE and load data into it using SQL commands below.

CREATE TABLE EMPLOYEE

(

              EMP_ID INT PRIMARY KEY,

              EMP_FNAME VARCHAR(200) NOT NULL,

              EMP_LNAME VARCHAR(200) NOT NULL,

              EMP_CITY VARCHAR(500) NULL ,

              EMP_STATE VARCHAR(20) NULL

)

  1. INSERT INTO EMPLOYEE VALUE (1, ‘Kevin’, ‘Lailnay’, NULL, ‘PA’)
  2. INSERT INTO EMPLOYEE VALUE (2, ‘Sarita, ‘Kawn, ‘Princeton’,’NJ’)
  3. INSERT INTO EMPLOYEE VALUE (2, ‘Gloria, ‘Pitts, ‘Allentown, ‘PA’)
  4. INSERT INTO EMPLOYEE VALUE (3, ‘Jose, ‘Hawillian, ‘Buffalo, ‘NY’)
  5. INSERT INTO EMPLOYEE VALUE (NULL, ‘Jose, ‘Hawillian, ‘Brooklyn, ‘NY)

Out of 5 INSERT commands above, which SQL INSERT commands will violate Entity Integrity? Copy and Paste those SQL commands.

And explain in detail why the Entity integrity is violated for each of those rows?

Homework Answers

Answer #1

INSERT INTO EMPLOYEE VALUE (NULL, ‘Jose, ‘Hawillian, ‘Brooklyn, ‘NY)

The above insert statement violates the Entity Integrity constraint.

As per the Entity Integrity constraint,the primary key in a table of the database cannot be NULL.The above insert statement clearly violates the condition as EMP_ID value which is the primary key is given NULL.

INSERT INTO EMPLOYEE VALUE (2, ‘Sarita, ‘Kawn, ‘Princeton’,’NJ’)

INSERT INTO EMPLOYEE VALUE (2, ‘Gloria, ‘Pitts, ‘Allentown, ‘PA’)

The above two INSERT statements are having duplicate primary key value of 2.It is also a violation but does not come under Entity Integrity constraint.It comes under Primary Key constraint of category Key constraints

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Summary The Ch08_ConstructCo database stores data for a consulting company that tracks all charges to projects....
Summary The Ch08_ConstructCo database stores data for a consulting company that tracks all charges to projects. The charges are based on the hours each employee works on each project. The structure and contents of the Ch08_ConstructCo database are shown in Figure P8.1. Use this database to answer the following problems. Database Schema The schema for the Ch08_ConstructCo database is shown below and should be used to answer the next several problems. Click this image to view it in its own...
SQL Data: you can just copy paste it into mysql to. CREATE DATABASE University;USE University; CREATE...
SQL Data: you can just copy paste it into mysql to. CREATE DATABASE University;USE University; CREATE TABLE Student (  sid INT PRIMARY KEY,  name VARCHAR(20) NOT NULL,  address VARCHAR(20) NOT NULL,  major CHAR(2)); CREATE TABLE Professor (  pid INT PRIMARY KEY,  name VARCHAR(20) NOT NULL,  department VARCHAR(10) NOT NULL); CREATE TABLE Course (  cid INT PRIMARY KEY,  title VARCHAR(20) NOT NULL UNIQUE,  credits INT NOT NULL,  area VARCHAR(5) NOT NULL); CREATE TABLE Transcript (  sid INT,  cid INT,  pid INT,  semester VARCHAR(9),  year YEAR,  grade CHAR(1) NOT NULL,  PRIMARY KEY (sid, cid, semester, year),  FOREIGN KEY (sid) REFERENCES Student...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL CPTR HIST MATH RELB Data Type Text Text Text Text Text Number Currency Date/Time Text DEPT_TITLE Biology Computer Science History Mathematics Religion    Field Name DEPT_CODE DEPT_TITLE Data Type Text Text INSTRUCTIONS Use SQL commands to create the tables and enter the data shown above using MS Access. Write the following SQL statement given below: 1. 2. 3. 4. 5. 6. 7. 8. 9....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT