0% found this document useful (0 votes)
7 views18 pages

Pkaaa Final

The document outlines a series of tasks related to database management using MySQL, specifically focusing on creating and manipulating a 'products' table within a 'company' database. It includes instructions for creating the database, defining the table structure, inserting records, and executing various queries to display and modify data based on specific criteria. The tasks range from basic operations like displaying records to more complex queries involving constraints, sorting, and data aggregation.

Uploaded by

sammamehra07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views18 pages

Pkaaa Final

The document outlines a series of tasks related to database management using MySQL, specifically focusing on creating and manipulating a 'products' table within a 'company' database. It includes instructions for creating the database, defining the table structure, inserting records, and executing various queries to display and modify data based on specific criteria. The tasks range from basic operations like displaying records to more complex queries involving constraints, sorting, and data aggregation.

Uploaded by

sammamehra07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

INFORMATICS PRACTICES

PART-3 DATABASE QUERY USING MYSQL

Create the following table products and


write queries given below-
Question-1 Create a database company.

Question-2 To Start Working With The Database Company.

Question-3 Create the above table products.

Question-4 Display the structure of the table.


Question-5 Insert the records as shown in the table.

Question-6 Display all the records of the above table.


Question-7 Display the records of the table with qty less than 50.

Question-8 Display the records of the table with price between


15000 to 45000.
Question-9 Display the product code and product name of the
products whose quantity is between 100 and 120 (both inclusive).

Question-10 Display the records of the table in ascending order of


product name.

Question-11 Display the records of the table in descending order of


company name.
Question-12 Display the records in ascending order of price.

Question-13 List all the records with the company name apple.

Question-14 Display all the records whose company name starts


with the letter ‘p'.

Question-15 Display all the records having the letter ‘e’ in the
product name.
Question-16 Display all the records whose company name ends
with the letter ‘a'.

Question-18 Add the constraint not null to the product name.

Question-19 Add the column location to the above table.

Question-20 Modify the attribute of company from 20 to 30.


Question-21 Modify the attribute of company from null to not null.

Question-22 Set the default value of location to Delhi.

Question-23 Remove the constraint primary key from the above


table.

Question-24 Display the names of all the products along with their
qty sold for 12 months(assuming qty represents quantity sold per
month).
Question-25 Display the company names without repetition.

Question-26 Display the records whose company is apple and price


is 15000.

Question-27 Display all the records except the records with


company name sony.
Question-28 Remove the attribute location from the above table.

Question-29 Display the product number, product name, price and


company in the ascending order of their price.

Question-30 Display the contents of the table in the descending


order of their price.
Question-31 Display product name (last four letters only), qty, price
and company for price in between 30000 to 80000.

Question-32 Join the columns product name and company and


display in tabular form like- ‘manufatured by’ company.

Question-33 Display all the records whose product code is either


p1001,p1002,or p1003.
Question-34 Display unique products from the table.

Question-35 Display maximum price of products.

Question-36 Display the total quantities of all products.


Question-37 Display the average price of led tv and apple products.

Question-38 Find the difference between maximum price and


minimum price from the table.

Question-39 Display unique products from the table.


Question-40 Count the unique company from products.

Question-41 Display product minimum price for each company.

Question-42 Display the maximum price of products manufactured


by apple.
Question-43 Round the value of pi (3.14159) to two decimal places.

Question – 44 Calculate the remainder when 125 is divided by 8.

Question-45 Display the number of characters in the word 'philips’.


Question-46 Display details from pname column after removing any
leading and trailing spaces.

Question-47 Determine the count of rows in the products table.

Question-48 Display the number of characters in each company.


Question-49 Display book titles in lowercase.

Question-50 Display all the records of the table products with


company name 4 characters.

You might also like