Fundamentals of Database Systems
a) Create table:
Create table Product(ProductId int primary key,ItemNum int not null,QuantityUsed intCheck(QuantityUsed>=0),ItemDescription varchar(200), ProductDescription varchar(200),ReceiptNumber int not null,QuantitySold int check(QuantitySold>=0) ,SalesDate DateTime)
b) In 3rd NormalForm, divide the Product table into sub table according to its dependency
so first of all we create all the dependency tables as follows:
1. Create item table
Create table item(ItemNum int primary key, ProductId int references Product(ProductId),
ItemDescription varchar(200), QuantityUsed int Check(QuantityUsed>=0))
2. Create Receipt table
Create table Receipt(ReceiptNumber int primary key, QuantitySold int check(QuantitySold>=0),
SalesDate DateTime))
3. Create ProductQuantity table
Create table ProductQuantity(ProductId int primary key, QuantityUsed int Check(QuantityUsed>=0),
ProductDescription varchar(200), QuantitySold int check(QuantitySold>=0) )
C. ERD
D. Script for create a database and table
USE [Test]
GO
CREATE DATABASE [Test] ON PRIMARY
( NAME = N'Test', FILENAME = N'\FSASQLDBTest.mdf' ,
SIZE = 2GB , MAXSIZE = 8GB, FILEGROWTH = 1GB )
LOG ON
( NAME = N'Test_log', FILENAME = N'\FSASQLDBTest_log.ldf' ,
SIZE = 1GB , MAXSIZE = 2GB , FILEGROWTH = 10%)
GO
USE [Test]
GO
CREATE TABLE [dbo].[Product]
(
[ProductId] [INT] PRIMARY KEY,
[ItenNum] [INT] NOT NULL,[QuantityUsed] [INT]NOT NULL,
[ItemDescription] [nchar](200)NULL,
[ProductDescription] [nchar](200) NULL,[ReceiptNumber][INT] NOT
NULL,[QuantitySold][INT]
[SalesDate] DATETIME NULL
) ON [PRIMARY]
GO
Fundamentals of Database Systems Consider the following data. Arrows show the functional dependency Product Item ld...
Question #1 Consider the following Table All information have been placed in one table. Arrows show the functional dependency. You are required to place this table in 3rd normal form The arrows in this question indicated the determination of two attributes. For example, the arrow that goes ProductID to ProductDescription indicates that ProductID determines the ProductDescription. This in turn means that ProductId can be considered as primary key for ProductDescription a) Write the tables b) Place the tables in 3rd...
The lab for this week addresses taking a logical database design (data model) and transforming it into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test data for the tables you create as you complete this exercise. Your job will be to use the ERD Diagram found below as a guide to define the...