Question: ** WRITE AND EXECUTE SQL QUERIES** **TO BE DONE IN SQL** 3. Create the tables identified below in the following order Campus (CampusID, CampusName, Street,

** WRITE AND EXECUTE SQL QUERIES**

**TO BE DONE IN SQL**

** WRITE AND EXECUTE SQL QUERIES** **TO BE DONE IN SQL** 3.

Create the tables identified below in the following order Campus (CampusID, CampusName,

Street, City, State, Zip, Phone, CampusDiscount) Position (PositionID, Position, YearlyMembershipFee) Members (MemberD,

LastName, FirstName, CampusAddress, CampusPhone, CampusID, PositionID, ContractDuration) FK CampusID >Campus(CampusID) PositionID Position(PositionID)

3. Create the tables identified below in the following order Campus (CampusID, CampusName, Street, City, State, Zip, Phone, CampusDiscount) Position (PositionID, Position, YearlyMembershipFee) Members (MemberD, LastName, FirstName, CampusAddress, CampusPhone, CampusID, PositionID, ContractDuration) FK CampusID >Campus(CampusID) PositionID Position(PositionID) Prices (FooditemTypeID, MealType, MealPrice) FoodItems (FoodItemID, FoodItemName, FoodItemTypeID) FK FoodItemTypeID > Prices(FoodItemTypeID) Orders (OrderID, MemberID, OrderDate) FK MemberID -> Members(MemberID) OrderLine (OrderID, FoodItemsID Quantity) FK OrderID Orders(OrderID) FoodItemsID FoodItems(FoodItemID) STRUCTURE NOTES: Use the proper naming convention for your constraints: Example: Constraint TableName_FieldName_ConstraintID (Campus_CampusID_PK) Set up the Primary Keys for each table with Constraints listed Note: The OrderLine Table has a composite Primary Key Add Your Foreign Keys for each table with your Constraints listed Set up your Sequence for the Prices table ONLY. Remember to follow the proper naming convention. The Sequence will be used in the insert commands to add your auto numbering into the Primary Key (FoodItemTypeID) fields. Name the Sequence "Prices_FoodItemID_Seq" Make the Data Types for all the Primary Keys and their corresponding Foreign Keys Varchar2(5) Make the Data Type for OrderDate Varchar2(25). (we won't worry about the date format, way too complicated for what we are doing) Make the Data Types for the MealPrice and YearlyMembershipFee Demal, 7 digits maximum with 2 digits to the right of the decimal place, so that we can perform calculations on them Make the Data Types for ContractDuration, and Quantity Integer with 3 digits maximum for calculation purposes. Make the Data Type for CampusDiscount Decimal, 2 digits maximum with 2 digits to the right of the decimal place Step 2 Use the Insert Into Command to add your data to each table. Add data to your primary tables first and then to your secondary tables. Also, remember to use the sequence code with your insert statement to add the auto number value to each primary key field

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!