हिंदी

Consider the following tables: Table 1: PRODUCTS This table stores the basic details of the products available in a shop. PID 201 202 203 204 205, PName Laptop Chair Desk Smartphone Tablet Category - Informatics Practices

Advertisements
Advertisements

प्रश्न

Consider the following tables:

Table 1: PRODUCTS

This table stores the basic details of the products available in a shop.

PID PName Category
201 Laptop Electronics
202 Chair Furniture
203 Desk Furniture
204 Smartphone NULL
205 Tablet Electronics

Table 2: SALES

This table records the number of units sold for each product.

SaleID PID UnitesSold
301 201 50
302 202 100
303 203 60
304 204 80
305 205 70

Write SQL queries for the following:

  1. To delete those records from table SALES whose UnitsSold is less than 80.
  2. To display names of all products whose category is not known.
  3. To display the product names along with their corresponding units sold.
कोड लेखन
Advertisements

उत्तर

  1. DELETE FROM SALES WHERE UNITSSOLD < 80;
  2. SELECT PNAME FROM PRODUCTS WHERE CATEGORY IS NULL;
  3. SELECT P. PNAME, S.UNITSSOLD FROM PRODUCTS P JOIN SALES S ON P.PID = S.PID;
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2024-2025 (March) Set 4

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×