Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*I already completed the first screenshot, but sent it just to show what we're doing. I just need to do Questions 1-3 on the second

*I already completed the first screenshot, but sent it just to show what we're doing. I just need to do Questions 1-3 on the second screenshot* image text in transcribed

image text in transcribed

*Again I just need numbers 1-3. Thanks*

Before you start on this assignment you need to create a new Database named college using the following commands. DROP DATABASE IF EXISTS college; CREATE DATABASE college; If at any point you wish to start over, you can run these two commands again. The commands will completely delete the mytestdb and then create an empty database. Write an SQL script that creates the following four tables with the constaints as indicated for each: Hint: If you create the foreign references in the CREATE TABLE command you have to create the tables in the correct order for the foreign key references to work. Alternatively, you can create the tables first and then use ALTER TABLE statements to create the foreign key references. Jsing the Northwind Database, create the following MySQL queries. 1. List the CustomerID, CompanyName and complete address for all customers that have a CustomerID that starts with the letter J,K,L,M or N. Concatenate the customer's Address, City, Region, PostalCode, and Country in one column named "Complete Address". Ensure to add spaces between each one. Sort the list in alphabetical order by CompanyName. (Hints: Since the Region and PostalCode columns used in the complete address may have a Null value, you must use the IFNULL function for these columns. Use a replacement value of an empty string. If you do not, the result of the CONCAT function will be Null. See pages 286-287 in textbook. Also, see the use of the REGEXP operator on pages 100-101.) Here is an example of using the IFNULL function with the CONCAT function. In this example if SampleColumn is Null, the IFNULL function will return as space: CONCAT(IFNULL(SampleColumn, '"), "', AnotbenColumn) 2. List each HOURLY employee's first and last name and their estimated yearly salary. Use 2080 as the number of hours worked annually. Concatenate the employee last and first names separated by a comma. Name the columns appropriately. Display the Yearly Salary with zero decimal places. Sort in alphabetical order by LastName. (Hint. This query will require the use of two tables.) 3. List the ten ProductNames with the highest inventory values (UnitPrice x UnitsInStock). Name the columns "Products" and "Inventory Value". Round the inventory values to two decimal places. (Hint: When referring to column aliases in the ORDER BY clause, use tick marks instead of quotation marks.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago