Advertisements
Advertisements
Question
Write a suitable SQL query for the following:
- To extract the first five characters from the
product_codecolumn in theProductstable. - To display the total number of orders from
Order_Idcolumn in theOrderstable. - To display the year of the order dates from the order_date column in the
Orderstable. - To display the
Addresscolumn from theCustomerstable after removing leading and trailing spaces. - To display the current date.
Code Writing
Advertisements
Solution
-
SELECT LEFT(product_code, 5) FROM Products; -
SELECT COUNT(Order_Id) FROM Orders; -
SELECT YEAR(order_date) FROM Orders; -
SELECT TRIM(Address) FROM Customers; -
SELECT DATE(NOW());
shaalaa.com
Is there an error in this question or solution?
