5 Functional DELETE Statements,Each of the DELETE Statements must be preceded by a SELECT Statement that lists the rows/tuples that are going to be deleted based on the criteria in the DELETE Statement.   After each DELETE Statement executes, the result set of DELETE Statement should indicate the number of items deleted.  The number of items deleted should match the number of items listed in the Resultset created by the SELECT Statement that proceeds each DELETE Statement.?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

how can I create

5 Functional DELETE Statements,Each of the DELETE Statements must be preceded by a SELECT Statement that lists the rows/tuples that are going to be deleted based on the criteria in the DELETE Statement.

 

After each DELETE Statement executes, the result set of DELETE Statement should indicate the number of items deleted.  The number of items deleted should match the number of items listed in the Resultset created by the SELECT Statement that proceeds each DELETE Statement.?

  • Relational schema

The primary key is bold and the foreign key is italic

 

Region(regionID, regionName, director)

StateOfRegion(stateCode, stateName, statePopulation, RegionID)

Store(StoreID, phone, manager, address, regionID)

Employee(empIDstoreID, empName, hireDate, birthDate, socSecNum)

Supplier(supplierID, SupplierName, contact, email, phone)

StoreSupplier(storeID, supplierID, startDate)

 

  • Meta dataThe metdata for each table from the given ER diagram is as below 

Table Name

Attribute

Data Type

Constraint

Region

 

 

 

 

regionID

INT

PK

 

regionName

VARCHAR

NOT NULL 

 

director

VARCHAR

 

 

 

 

 

StateOfRegion

 

 

 

 

stateCode

CHAR(2)

PK

 

stateName

VARCHAR

Not NULL

 

statePopulation

double

 

 

regionID

int

FK Region(RegionID)

 

 

 

 

Store

 

 

 

 

storeID

int

PK

 

phone

VARCHAR

Not Null

 

manager

int

Not Null

 

address

VARCHAR

Not Null

 

regionID

int

FK Region(RegionID)

 

 

 

 

Employee

 

 

 

 

empID

Int

PK

 

storeID

int

FK Store(StoreID)

 

empName

VARCHAR

Not Null 

 

hireDate

Date

Not Null 

 

birthDate

Date

 

 

socSecNum

Int

 

 

 

 

 

Supplier

 

 

 

 

supplierID

INT

PK

 

supplierName

VARCHAR

Not null

 

contact

VARCHAR

Not null

 

email

VARCHAR

Not null

 

phone

VARCHAR

Not null

 

 

 

 

StoreSupplier

 

 

 

 

storeID

Int

PK, FK store(StoreID)

 

supplierID

int

PK, FK Supplier(SupplierID)

 

startDate

Date

Not null

 

  • The create table script:

 

 

DROP DATABASE IF EXISTS RegionStore;

CREATE DATABASE RegionStore;

USE  RegionStore;

 

CREATE TABLE Region

(

regionID         VARCHAR(10),

regionName       VARCHAR(50),

supervisor       VARCHAR(50),

 

CONSTRAINT PRIMARY KEY (regionID)

 

);

 

CREATE TABLE Store 

(

storeID           VARCHAR (10),

storeAddress      VARCHAR (50),

phone             VARCHAR (10),

Manager           VARCHAR (10),

regionID_FK       VARCHAR (10),

 

CONSTRAINT PRIMARY KEY (storeID),

CONSTRAINT FOREIGN  KEY (regionID_FK)  

REFERENCES REGION (regionID)

 

);



CREATE TABLE Employee

 

(

empNum             VARCHAR (10),

empName            VARCHAR (50),

hireDate           DATE,

birthDate          Date, 

socSecNum          CHAR(9),

storeID_FK         VARCHAR(10),

 

CONSTRAINT PRIMARY KEY (empNum),

CONSTRAINT FOREIGN KEY (storeID_FK)

REFERENCES Store(storeID)

 

);




CREATE TABLE Supplier

 

(

supplierID             VARCHAR (10),

supplierName           VARCHAR (50),

contact                VARCHAR (50),

phone                  CHAR (10),

email                  VARCHAR (50),

 

 

CONSTRAINT PRIMARY KEY (supplierID)

 

 

);



CREATE TABLE Supplies

 

(

supplierID_FK          VARCHAR (10),

storeID_FK             VARCHAR (10),

startDate              DATE,

 

CONSTRAINT PRIMARY KEY (supplierID_FK,storeID_FK )

 

);



CREATE TABLE StateOfRegion

(

 

stateCode                CHAR(2),

stateName                VARCHAR(50),

regionID_FK              VARCHAR(10),

statePopulation          INT,

 

CONSTRAINT PRIMARY KEY (stateCode),

 

CONSTRAINT FOREIGN KEY (regionID_FK )

REFERENCES REGION(regionID)

 

);

INSERT INTO region (regionID,regionName,supervisor)
VALUES ('001','Alabama','Henry');

INSERT INTO Region (regionID,regionName,supervisor)
 VALUES ('003','wellington','katty');

INSERT INTO Region (regionID,regionName,supervisor)
 VALUES ('004','hamilton','ross');
 
INSERT INTO Region (regionID,regionName,supervisor)
 VALUES ('005','auckland','robert');




 

## Entity-Relationship Diagram (ERD) for Store Management System

### Entities and Relationships

This ERD displays the entities involved in a store management system and the relationships between them.

1. **Region**
   - **Attributes:**
     - `regionID`: Unique identifier for the region
     - `regionName`: Name of the region
     - `director`: Director of the region

2. **StateOfRegion**
   - **Attributes:**
     - `statecode`: Unique code for the state
     - `stateName`: Name of the state
     - `statePopulation`: Population of the state
     - `RegionID_FK`: Foreign key referring to `regionID` from the Region entity

   - **Relationships:**
     - `In`: A 1:M (one-to-many) relationship with Region indicating that one region can encompass many states.

3. **Store**
   - **Attributes:**
     - `Store_ID`: Unique identifier for the store
     - `phone`: Store phone number
     - `manager`: Name of the store manager
     - `address`: Physical address of the store
     - `RegionID_FK`: Foreign key referring to `regionID` from the Region entity

   - **Relationships:**
     - `Contain`: A 1:M (one-to-many) relationship with Region indicating that one region can contain multiple stores.

4. **Employee**
   - **Attributes:**
     - `empID`: Unique identifier for the employee
     - `empName`: Name of the employee
     - `hireDate`: Date when the employee was hired
     - `birthDate`: Employee's birth date
     - `socSecNum`: Social Security Number of the employee

   - **Relationships:**
     - `Employ`: A 1:M (one-to-many) relationship with Store, indicating that one store can employ multiple employees.
     - `Manages`: A 1:1 relationship indicating that one employee manages one store, and one store is managed by one employee.

5. **Supplier**
   - **Attributes:**
     - `supplierID`: Unique identifier for the supplier
     - `supplierName`: Name of the supplier
     - `contact`: Contact person for the supplier
     - `email`: Email address of the supplier
     - `phone`: Phone number of the supplier

6. **Supplies**
   - **Attributes:
Transcribed Image Text:## Entity-Relationship Diagram (ERD) for Store Management System ### Entities and Relationships This ERD displays the entities involved in a store management system and the relationships between them. 1. **Region** - **Attributes:** - `regionID`: Unique identifier for the region - `regionName`: Name of the region - `director`: Director of the region 2. **StateOfRegion** - **Attributes:** - `statecode`: Unique code for the state - `stateName`: Name of the state - `statePopulation`: Population of the state - `RegionID_FK`: Foreign key referring to `regionID` from the Region entity - **Relationships:** - `In`: A 1:M (one-to-many) relationship with Region indicating that one region can encompass many states. 3. **Store** - **Attributes:** - `Store_ID`: Unique identifier for the store - `phone`: Store phone number - `manager`: Name of the store manager - `address`: Physical address of the store - `RegionID_FK`: Foreign key referring to `regionID` from the Region entity - **Relationships:** - `Contain`: A 1:M (one-to-many) relationship with Region indicating that one region can contain multiple stores. 4. **Employee** - **Attributes:** - `empID`: Unique identifier for the employee - `empName`: Name of the employee - `hireDate`: Date when the employee was hired - `birthDate`: Employee's birth date - `socSecNum`: Social Security Number of the employee - **Relationships:** - `Employ`: A 1:M (one-to-many) relationship with Store, indicating that one store can employ multiple employees. - `Manages`: A 1:1 relationship indicating that one employee manages one store, and one store is managed by one employee. 5. **Supplier** - **Attributes:** - `supplierID`: Unique identifier for the supplier - `supplierName`: Name of the supplier - `contact`: Contact person for the supplier - `email`: Email address of the supplier - `phone`: Phone number of the supplier 6. **Supplies** - **Attributes:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education