This is using MySQL server 2016, i know you dont have the server but if you can
ID: 3745403 • Letter: T
Question
This is using MySQL server 2016, i know you dont have the server but if you can respond to each number here with how it would be typed so it does the task when executed that would be helpful!
1.Selecting all columns from the Products table using *:
2.Selecting the ProductID and ProductName columns from the Products table:
3.Describe what the following statement will return:
SELECT CustomerID, CompanyName, ContactName
FROM Customers
where CompanyName LIKE ‘%S’
4.Select the OrderID, CustomerID, and EmployeeID from the Orders table where the ShipCity is equal to ‘Strasbourg’
5.Select the OrderID, CustomerID, and EmployeeID from the Orders table where the ShipCity is not equal to ‘Strasbourg’ and the ShipCountry is equal to ‘Austria’
6.Select the OrderID and EmployeeID from the Orders table where the ShipCity is not equal to ‘Strasbourg’ or the ShipCountry is equal to ‘Austria’
7.Select the OrderID, ShipRegion, and ShipPostalCode from the Orders table where the ShipCity is equal to either ‘Seattle’ or ‘Lander’ using the IN keyword
8.Select the OrderID, ShipRegion, and ShipPostalCode from the Orders table where the ShipCity starts with the letter ‘R’
9.Select all columns from the Customers table where the Phone does not contain ‘(307)’
10.Select all columns from the Orders table where the OrderDate is greater than October 13, 1997
11.Select all columns from the Orders table where the OrderDate is in the year 1997
12.Select the ProductName, ProductID, and a column aliased as ‘StockValue’ that multiplies the UnitPrice with the UnitsInStock from the Products table
13.Select the TitleOfCourtesy, FirstName, LastName, and a column aliased as ‘FullName’ that concatenates all 3 columns with a space in between from the Employees table.
For example, the result should look like Mr. John Doe, not Mr.JohnDoe
14.Using the resulting query from Question 13, change the result of the aliased column of FullName to include an apostrophe at the beginning and the end of the name.
For example, the result should look like ‘Mr. John Doe’, not Mr. John Doe
15.Select the distinct EmployeeID values from the Orders table. Hint: the result should match the same row count as the number of records in the Employees table
15.Return the top 3 rows from the Orders table
16.Return the top 50% of rows from the Customers table
Explanation / Answer
I would answer according to the statement being provided as no exact schema definition is with the question.
1. SELECT * FROM Products -- Selecting all rows and columns of the table using the * operator.
2. SELECT ProductID, ProductName FROM Products -- Retrieves only two columns but all rows from the Products table.
3. SELECT CustomerID, CompanyName, ContactName
FROM Customers
where CompanyName LIKE ‘%S’
The above statement uses a like operator with '%S' which would return all the CustomerID, CompanyName and ContactName from the Customers table where the CompanyName ends with s.
4. SELECT OrderID, CustomerID, EmployeeID
FROM Orders
WHERE ShipCity = "Strasbourg"
-- Selects those OrderID, CustomerID and EmployeeID from Orders which were shipped from Strasbourg
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.