English

Write a suitable SQL query for the following: I. To extract the first five characters from the product_code column in the Products table. - Informatics Practices

Advertisements
Advertisements

Question

Write a suitable SQL query for the following:

  1. To extract the first five characters from the product_code column in the Products table.
  2. To display the total number of orders from Order_Id column in the Orders table.
  3. To display the year of the order dates from the order_date column in the Orders table.
  4. To display the Address column from the Customers table after removing leading and trailing spaces.
  5. To display the current date.
Code Writing
Advertisements

Solution

  1. SELECT LEFT(product_code, 5) FROM Products;
  2. SELECT COUNT(Order_Id) FROM Orders;
  3. SELECT YEAR(order_date) FROM Orders;
  4. SELECT TRIM(Address) FROM Customers;
  5. SELECT DATE(NOW());
shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×