Question No.1 Create two tables namedCustomers (having fields / columns Customer
ID: 3616584 • Letter: Q
Question
Question No.1
Create two tables namedCustomers (having fields / columns Customer_No, First_Name,Last_Name, and Address) and Order (having fields / `columnsOrder_No, Customer_No, OrderDate and PromisedDate). Therelationship between these two tables is one-to-many (i.e. a singleCustomer may have many Orders; a single Order belongs to one andonly one Customer). The code you use to create the tablesmust enforce uniqueness integrity and referential integrity. Show the SQL code used to create the tables.
Visit this link forparticular data types you will use: http://msdn.microsoft.com/en-us/library/ms187752.aspx
Question No.2
Create a view namedCustOrder thatincludes the following fields: Customer_No, Order_No, First_Nameand Last_Name. Show the SQL code used to create thisview.
Explanation / Answer
SQL Command for creating customer table is given below:-
create table Customers
(Customer_No integer PRIMARY KEY,
First_Name varchar(15),
Last_Name varchar(15),
Address varchar(80));
SQL Command for creating Order Table is given below:-
create table Order
(Order_No integer PRIMARY KEY,
Customer_No references CUSTOMERS(Customer_No),
Order_Date date,
Promise_Date date);
CREATE VIEW [CustOrder]
AS SELECT [Customers].[Customer_No],[Order].[Order_No],[Customers].[First_Name], [Customers].[Last_Name]FROM [Customers],[Order]
Hope you will rate higher
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.