Assignment Week 2
Assignment Week 2
Assignment Week 2
Eduardo Torres
YOU ARE TO USE SQL COMMANDS TO BUILD THESE UNLESS OTHERWISE NOTED.
1. Create a new database named CIS605. Assign a SIZE of 10, MAXSIZE of 100, FILEGROWTH of 5. For
the log file (LDF) assign a SIZE of 40, MAXSIZE of 100, FILEGROWTH of 10. When you run the SQL and
the database is created copy and paste the SQL and the Messages output to your assignment Word
document.
*****
Create a table for the CIS605 database called employee with the following columns:
integer employee number
character first name
character last name
character department number (4 digits)
Specify all four columns as NOT NULL
Add a constraint that sets the employee number as the primary key.
When you run the SQL and the database is created copy and paste the SQL and the Messages output
to your assignment Word document.
*****
Use the select statement you used for week 1 to display the database name, file type, logical file
name, physical file, and state for cis605. copy and paste the SQL statement and the Results to your
assignment Word document.
ASSIGNMENT WEEK 2 3
*****
3. Write a select statement to select the person type, last name, email promotion from persons and
the country region code from the state province. Select only records where the email promotion code
equals 2, sort by last name, offset 20 rows and only fetch 10 rows.
*****
4. Write an INNER JOIN query on two tables. The two tables are the production product table and the
sales shopping cart item table joined on product ID. The required columns in the report are product
ID, product name with a column header of ProductName, from the product table and quantity,
shopping cart item ID from the shopping cart item table. The output should resemble the example
below.
*****
5. Write a correlated subquery using the Production Product table, columns Name and Product
Number. The subquery table is the purchasing product vendor table and the subquery should select
only records where the minimum order quantity equals 100. The output should display the Name and
Product Number sorted by Name, offset by 0 rows, fetching only the first 10 rows.