This is using MySQL server 2016, i know you dont have the server but if you can
ID: 3745453 • 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!(please answer all 1-16 comment on why its written that way too please)
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
If you have any doubts, please give me comment...
-- 1)
SELECT *
FROM Products;
-- 2)
SELECT ProductID, ProductName
FROM Products;
-- 3)
SELECT CustomerID, CompanyName, ContactName
FROM Customers
WHERE CompanyName LIKE '%s';
-- The query it returns "find the all customers Id, company name, contact name, whose company name end with s
-- 4)
SELECT OrderID, CustomerID, EmployeeID
FROM Orders
WHERE ShipCity='Strasbourg';
-- 5)
SELECT OrderID, CustomerID, EmployeeID
FROM Orders
WHERE ShipCity<>'Strasbourg' AND ShipCountry='Austria';
-- 6)
SELECT OrderID, EmployeeID
FROM Orders
WHERE ShipCity<>'Strasbourg' AND ShipCountry='Austria';
-- 7)
SELECT OrderID, ShipRegion, ShipPostalCode
FROM Orders
WHERE ShipCity IN ('Seattle', 'Lander');
-- 8)
SELECT OrderID, ShipRegion, ShipPostalCode
FROM Orders
WHERE ShipCity LIKE 'R%';
-- 9)
SELECT *
FROM Customers
WHERE Phone NOT LIKE '(307)';
-- 10)
SELECT *
FROM Orders
WHERE OrderDate > '1997-10-13';
-- 11)
SELECT *
FROM Orders
WHERE YEAR(OrderDate)=1997;
-- 12)
SELECT ProductName, ProductID, UnitPrice*UnitsInStock AS StockValue
FROM Products;
-- 13)
SELECT TitleOfCourtesy, FirstName, LastName, CONCAT(TitleOfCourtesy,' ', FirstName, ' ', LastName) FullName
FROM Employees;
-- 14)
SELECT TitleOfCourtesy, FirstName, LastName, CONCAT("'", TitleOfCourtesy,' ', FirstName, ' ', LastName, "'") FullName
FROM Employees;
-- 15)
SELECT DISTINCT EmployeeID
FROM Orders;
-- 16)
SELECT *
FROM Orders
LIMIT 3;
17)
SELECT TOP 50 PERCENT
FROM Customers;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.