Discussion forum week 8 PDF

Title Discussion forum week 8
Course Databases 1
Institution University of the People
Pages 3
File Size 84.3 KB
File Type PDF
Total Downloads 58
Total Views 155

Summary

Discussion forum week 8 answer...


Description

Testing the Orders database introduced in Wat (2014) - Appendix C.

Problem 1 In creation of tblCustomers, there is a syntax error due to the following: CREATE TABLE [dbo].[tblCustomers] … );

Note that no open parenthesis “(“ were provided after the table name. Thus to correct this, is to provide “(“

Problem 2 The data type use for the creation of tblCustomers is nvarchar() as shown: [CustomerID] nvarchar(5) NOT NULL, [CompanyName] nvarchar(40) NOT NULL, [ContactName] nvarchar(30) NULL, [ContactTi nvarchar(15) NULL, [PostalCode] nvarchar(10) NULL, [Country] nvarchar(15) NULL nada’, [Phone] nvarchar(24) NULL, ey (CustomerID)

An error were received when using nvarchar(), we tried nchar alone and result to creating of the table Problem 3 Constraints of the country atribute default as shown [Country] nvarchar(15) NULL Constraint df_country DEFAULT ‘Canada’,

As per W3Schools (n.d.), it can be writen as:

Country varchar(255) DEFAULT 'Canada',

Note that NULL is not required since default value is ‘Canda’. Thus, nvarchar or nchar will create error. Problem 5 In the creation of tbleSupplier, tbleShippers and some table creation, the same problem with the creation of tblCustomer. Problem 6 In the creation of tblproduct, the problem is with the datatype money for UnitPrice and bit for Discontinued: Problem 7 [UnitPrice] money NULL, [Discontinued] bit NOT NULL To correct this, we simple use: [UnitPrice] float NULL, [Discontinued] int NOT NULL

In the creation of tblOrder, the problem is with the datatype money for Freight and smalldatetime for OrderDate, RequiredDate, &ShippingDate:

[OrderDate] smalldatetime NULL, [RequiredDate] smalldatetime NULL, [ShippedDate] smalldatetime NULL, [Freight

To correct this, we simple use: [OrderDate] dateNULL, [RequiredDate] date NULL, [ShippedDate] date NULL, [Freight] float NULL

Reference

W3Schools (n.d.). SQL Default Constraint. Retrieved from htps://www.w3schools.com

/sql/sql_default.asp Wat, A. and N. Eng. (2014). Database Design – 2nd Edition. Victoria, B.C.: BCcampus. Retrieved from htps://opentextbc.ca/dbdesign01/....


Similar Free PDFs