Question
The final project requires a physical design of the database of Daisy flower shops. This database should be normalized in 3rd normal form. Write the
The final project requires a physical design of the database of Daisy flower shops. This database should be normalized in 3rd normal form. Write the CREATE TABLE statements for all the entities in the database you have been designing. Make sure to include the primary keys and foreign keys, plus the data types for each attribute. In addition, write INSERT statements to input 10 rows of data into at least one of your tables.
Submit your assignment in MS Word format via the assignment link.
The CREATE TABLE statement is used to create a new table in a database. The table is defined with a set of columns and data types, along with any constraints (e.g. NOT NULL, PRIMARY KEY, UNIQUE) for each column.
Syntax:
CREATE TABLE table_name (
column1 data_type constraint,
column2 data_type constraint,
...
columnN data_type constraint
);
CREATE TABLE Purchases (
PurchaseID INT PRIMARY KEY,
FlowerID INT NOT NULL,
CustomerID INT NOT NULL,
EmployeeID INT NOT NULL,
PurchaseDate DATE NOT NULL,
Quantity INT NOT NULL,
TotalCost DECIMAL(10, 2) NOT NULL,
FOREIGN KEY (FlowerID) REFERENCES Flowers(FlowerID),
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID),
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID)
);
-The above statement creates a table named Purchases with the specified attributes and constraints.
- The Purchase ID attribute is defined as the primary key and is set to auto-increment
- The FlowerID, Customer ID, and Employee ID attributes cannot be NULL and are defined as foreign keys referencing the FlowerID, CustomerID, and EmployeeID columns in the flowers, Customers, and Employees tables respectively.
The PurchaseDate, Quantity, and Total Cost attributes cannot be NULL.
- The FlowerID, Customer ID, and Employee ID attributes cannot be NULL and are defined as foreign keys referencing the FlowerID, CustomerID, and EmployeeID columns in the flowers, Customers, and Employees tables respectively.
The PurchaseDate, Quantity, and Total Cost attributes cannot be NULL.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started