Question

Create or edit the SQL statements required to accomplish the following tasks. All columns should have a column name, feel free to create appropriate aliases Use screen shots to ca evidence that each task is completed; include the SQL records before and after statements are executed, as appropriate. Include all work, even if you get errors. Paste your screen shots into a single PowerPoint file pture statements output from the statements, and views of the object explorer when necessary. Use SELECT statements to displey create a database and the following tab es Be sure to u se te a propna e lar guage Screen shot # 1 shot. display the SQL code and show the Object Explorer AFTER the database and tables are created . n a scrip three statements un ita sn le c ck of he r ec te bu on n he screen a. Create a database named LastName. Test4 using appropriate DDL statements, where LastName is your last name b. Create the tables and appropniate constraints based on the following ER diagram Use acpropriate data tyees and sizes (see Chanter B). The atabase is for a famity-owned bicycle store i. The AvailableOnline column should only accept the letters Y. or N (for Yes or No). ii. The Cost column should only have values greater than zero. L The SalePrice column should only have values greater than zero. iv. All columns in both tables are required v. The CID and PID columns should have the IDENTITY property Category Product CID PIO CID (fk) Ceet Screen shota) Add records to the Caregory teble and the Prosucta tabie. One screenshot should show the SQL code and the output of a SELECT statement showing the records in the taole (two screenshots. one for each table) Insert 3 rows in the Category table Bicycles 2. Accesoories 2. Inserd the iolowing records into the Product table 726 PM ^萨ヨ瀛8/192018

need help

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a. CREATE DATABASE lastNameTest4;

NOTE: Please replace lastName with your last name.

b.

CREATE TABLE Category (

CID int NOT NULL,

Description VARCHAR(50) NOT NULL,

PRIMARY KEY(CID)

);

CREATE TABLE Product (

PID int NOT NULL,

Description VARCHAR(50) NOT NULL,

CID int NOT NULL,

Cost int NOT NULL,

SalesPrice int NOT NULL,

AvailableOnline char(1) NOT NULL,

PRIMARY KEY(PID),

CHECK (Cost > 0),

CHECK (SalesPrice > 0),

FOREIGN KEY (CID) REFERENCES Category(CID)

);

c.

INSERT INTO Category VALUES (1, 'Bicycles');

INSERT INTO Category VALUES (2, 'Components');

INSERT INTO Category VALUES (3, 'Accessories');

INSERT INTO Product VALUES (1, 'Cosco Bicyle', 1, 1299, 1099, 'Y');

INSERT INTO Category VALUES (2, 'Gears', 3, 299, 249, 'N');

INSERT INTO Category VALUES (3, 'Pedals', 2, 199, 179, 'Y');

SELECT * FROM Category;

SELECT * FROM Product;

NOTE: Since you have not provided the values to be inserted into Product table, I have gone ahead and inserted random values.

Add a comment
Know the answer?
Add Answer to:
need help Create or edit the SQL statements required to accomplish the following tasks. All columns...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (#3a){Screenshot.} Create a VIEW named ProductProfit that displays the Category Description, Product Description, and the Profit (SalePrice - Cost). Name the Category description column ‘Category’ an...

    (#3a){Screenshot.} Create a VIEW named ProductProfit that displays the Category Description, Product Description, and the Profit (SalePrice - Cost). Name the Category description column ‘Category’ and the Product description ‘Item’. The screenshot should show the SQL code to create the view and a SELECT statement displaying the records returned in descending order of the Profit column. (#3b){Screenshot.} Using the ProductProfit VIEW, display the records that are in the TOP 10 Percent of Profit. The screenshot should show the SELECT statement...

  • Using MYSQL please help (#7){Screen shot} Write a script that removes the view, the two tables, and the database, with one click of the execute button. In the screen shot, display all the SQL code, an...

    Using MYSQL please help (#7){Screen shot} Write a script that removes the view, the two tables, and the database, with one click of the execute button. In the screen shot, display all the SQL code, and show the Object Explorer after the script executes. Add records to the Category table and the Products table. One screenshot should show the SQL code and the output of a SELECT statement showing the records in the table (two screenshots, one for each table)...

  • For this hands-on project, you will use the SQL Server named instance SQLSERVERHOA, and the HandsOnOne...

    For this hands-on project, you will use the SQL Server named instance SQLSERVERHOA, and the HandsOnOne database and tables you created in previous chapters. The objective of this activity is to practice generating keys and encrypting/decrypting data. Document each step by taking a screen shot of the Query Editor window after successfully executing each SQL query. 1.In SQL Server Management Studio, open a new Query Editor window, which you will use for completing all steps in this activity. 2.Create a...

  • Need help writing SQL statements. The questions involved use the following database Student SID – Integer...

    Need help writing SQL statements. The questions involved use the following database Student SID – Integer – Primary Key SName - String Address - String Classes ClassID – Integer – Primary Key ClassName - String Credits - Integer Grades SID – Integer – Primary Key CID – Integer – Primary Key Grade - Integer Q1 – Write a script that creates a view to show all the students and all the classes they took and the grades they got in...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • Write the following SQL statements in Microsoft Access by using the Books database from Week 2...

    Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...

  • Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accoun...

    Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accounting, and employee data, and these different data sets must all be efficiently managed in order to make the data accessible. Companies rely on database engineers to ensure that their records are accurate, updated, and tracked in real time. This course covers structured query language (SQL) and how it can be used to manage database schemas, manipulate data, and analyze data. For your final...

  • For this set of Review Questions, we will create and use a database for the Wedgewood...

    For this set of Review Questions, we will create and use a database for the Wedgewood Pacific Corporation (WPC) that is similar to the Microsoft Access database we created and used in Chapters 1 and 2. Founded in 1957 in Seattle, Washington, WPC has grown into an internationally recognized organization. The company is located in two buildings. One building houses the Administration, Accounting, Finance, and Human Resources departments, and the second houses the Production, Marketing, and Information Systems departments. The...

  • Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates...

    Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates to the following tables: • Employee table (project 1) create table Employee ( empNumber char(8) not null, firstName varchar(25) null, lastName varchar(25) null, ssn char(9) null, address varchar(50) null, state char(2) null, zip char(5) null, jobCode char(4) null, dateOfBirth date null, certification bit null, salary money null, constraint PK_EMP PRIMARY KEY(empNumber), constraint EMP_STATECHECK CHECK(state in ('CA','FL')) ) GO • Job table (project 1) create...

  • Using the tables provided above, provide SQL statements for the following queries. NOTE: YOU DO NOT NEED TO INSERT MOR...

    Using the tables provided above, provide SQL statements for the following queries. NOTE: YOU DO NOT NEED TO INSERT MORE DATA INTO THE TABLES. The list of tables available for this assignment is the following MODEL(modellD, economySeats, buisnessSeats, firstClassSeats, cargoCapacity, fuelCapacity, length, wingspan, serviceHours) LOCATION(airportCode, country, address, phone) TICKET ticketNum, luggageLimit, seatNum, classCode, medicalCondition, mealChoice, customerlD, flightID) ROUTE(routelD, description, arriveAirportCode, departAirportCode) IRREGULAR_EVENT(eventNumber,flightlD, eventDate TIme, eventDescription) SERVICE(serviceDate,airfD, description, cost) AIRCRAFT (aicraftlD, mailCargoCapacity, numMedPacks, numDefibritlators, haulType, modellD NEACC MEMBER(memberlD, flightGoldPoints) STAFF(stafflD, name,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT