Page 296 - PYTHON-12
P. 296

(vi)
                             Pname        Quantity      Rate
                             Eraser       100           5
                             Copy         50            20
                             Pencil       20            20
                             Book         10            100
                             Pen          10            20
                      (b)  Based on the Orders Table given above, write SQL query to display the minimum quantity, maximum
                         quantity and total quantity of Orders.
                Ans.  SELECT MIN(Quantity), MAX(Quantity), SUM(Quantity) FROM Orders;
                      (c)  What is the difference between COUNT(*) and COUNT(Column Name)?
                Ans.  COUNT(*) includes the cells in the column containing NULL values.
                      COUNT(Column name) ignores the cells in the column containing NULL values.

               UNSOLVED QUESTIONS

                 1.  What is an Alternate Key?
                 2.  What are views? How are they useful?
                 3.  Define the following terms:
                      (a)  Relation
                      (b)  Tuple
                      (c)  Attribute
                      (d)  Domain
                 4.  What do you understand by the terms candidate key and cardinality of a relation in a relational database?
                 5.  What is SQL? What are different categories of commands available in SQL?
                 6.  What is a database system? What is its need?
                 7.  Differentiate between DDL and DML commands.
                 8.  What is a datatype? Name some datatypes available in MySQL.
                 9.  Differentiate between char and varchar datatypes.
                 10.  Which operator concatenates two strings in a query result?
                 11.  How would you calculate 13*15 in SQL?
                 12.  Which keywords eliminate redundant data from a query?
                 13.  Write  SQL  queries  to  perform  the  following  based  on  the  table  PRODUCT  having  fields  as  (prod_id,
                    prod_name, quantity, unit_rate, price, city)
                      (i)  Display those records from table PRODUCT where prod_id is more than 100.
                      (ii)  List records from table PRODUCT where prod_name is ‘Almirah’.
                      (iii)  List all those records whose price is between 200 and 500.
                      (iv)  Display the product names whose price is less than the average of price.
                     14.  Define the following terms:
                      (v)  Show the total number of records in the table PRODUCT.
           Computer Science with Python–XII  12.66            (ii)  Data Inconsistency


                      (i)  Database
                      (iii)  Primary Key
                      (iv)  Candidate Key
                      (v)  Indexes
   291   292   293   294   295   296   297   298   299   300   301