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.
need help Create or edit the SQL statements required to accomplish the following tasks. All columns...
(#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, 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 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 – 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 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 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, 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 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 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 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,...