0% found this document useful (0 votes)
5 views

SQL commands for practical file only for IP students

Map points
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

SQL commands for practical file only for IP students

Map points
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL commands

1. How do you create a new database in SQL?


2. How can you delete an existing database?
3. How do you select a specific database to use?
4. How can you list all databases on the server?
5. How do you rename an existing database?
6. How can you create a new table in SQL?
7. How do you delete a table in SQL?
8. How can you add a new column to an existing table?
9. How do you delete a column from a table?
10. How do you rename a table in SQL?
11. How can you rename a column in SQL?
12. How can you change the data type of an existing column?
13. How do you insert data into a table?
14. How can you insert data into specific columns of a table?
15. How do you update existing data in a table?
16. How do you delete data from a table?
17. How can you truncate all data in a table?
18. How do you select all columns from a table?
19. How do you select specific columns from a table?
20. how do you calculate the total sum of a numeric column using SUM()?
21. How can you find the average value of a column using AVG()?
22. How do you count the number of rows in a table or based on a specific condition
using COUNT()?
23. How can you find the maximum value in a column using MAX()?
24. How do you find the minimum value in a column using MIN()?
25. How can you combine aggregate functions with GROUP BY to calculate totals for
each group?
26. How do you filter groups using HAVING with aggregate functions?
27. How can you count the distinct values in a column using COUNT(DISTINCT
column_name)?
28. How do you use multiple aggregate functions in a single query (e.g., SUM(),
MAX(), MIN() together)?
29.  How can you use aggregate functions on joined tables to get results from
multiple tables?
30. How can you filter records based on a condition?
31. How can you sort results in ascending or descending order?
32. How do you group records by a specific column?
33. How do you use a WHERE clause with aggregate functions?
34. How can you use HAVING to filter groups in SQL?
35. How do you use a CROSS JOIN to combine all records from two tables, and how can
you apply a condition to filter the results?
36. How can you use an INNER JOIN with conditions to return only rows where there is a
match in both tables based on specific conditions?
37. How do you apply multiple conditions in an INNER JOIN to filter results using both
AND and OR operators?
38. How can you use a NATURAL JOIN to join tables based on columns with the same
name, and how can you filter the results with additional conditions?
39. How do you use an EQUI JOIN to join tables based on a specific equality condition and
apply additional conditions to further filter the results?
40. How can you use a CROSS JOIN with a WHERE clause to create a filtered Cartesian
product based on specific conditions between columns?
41. How do you combine INNER JOIN with a WHERE clause to apply conditions both in
the join and after the join?
42. How can you use a NATURAL JOIN with a condition to further filter results based on
criteria unrelated to the common columns?
43. How do you use an EQUI JOIN with non-equality conditions (e.g., >, <) to join tables
and filter records?
44. How can you combine INNER JOIN and CROSS JOIN in a single query with
conditions to get specific combinations of records?
45. How do you combine the results of two queries to get all unique records using
UNION?
46. How do you find common records between two queries using INTERSECT?
47. How can you retrieve records from the first query that are not in the second
using EXCEPT or MINUS?
48. How do you use UNION, INTERSECT, and EXCEPT together to retrieve specific
results from multiple tables?
49. Create a student table with the student id, name, and marks as attributes where the
student id is the primary key.
50. Insert the details of a new student in the above table.
51. Delete the details of a student in the above table.
52. Use the select command to get the details of the students with marks more than 80.
53. Find the min, max, sum, and average of the marks in a student marks table.
54. Find the total number of customers from each country in the table (customer ID,
customer Name, country) using group by.
55. Write a SQL query to order the (student ID, marks) table in descending order of the
marks.

Math Functions

1. How do you round a number to the nearest integer using ROUND()?


2. How can you round a number to a specified decimal place using ROUND(number,
decimals)?
3. How do you find the absolute value of a number using ABS()?
4. How can you calculate the square root of a number using SQRT()?
5. How do you raise a number to a power using POWER(base, exponent)?
6. How can you calculate the remainder of a division using MOD(dividend,
divisor)?

String Functions

11. How do you convert text to uppercase using UPPER()?


12. How can you convert text to lowercase using LOWER()?
13. How do you get the length of a string using LENGTH() or LEN()?
14. How can you concatenate two strings using CONCAT()?
15. How do you extract a substring from a string using SUBSTRING() or SUBSTR()?
16. How can you remove spaces from the start and end of a string using TRIM()?
17. How do you replace a part of a string with another string using REPLACE()?
18. How can you find the position of a substring within a string using INSTR() or
POSITION()?

Date Functions

21. How do you get the current date using CURRENT_DATE or GETDATE()?
22. How can you get the current time using CURRENT_TIME or NOW()?
23. How do you get the current date and time using CURRENT_TIMESTAMP or NOW()?
24. How can you extract the year from a date using YEAR()?
25. How do you extract the month from a date using MONTH()?
26. How can you extract the day from a date using DAY() or DAYOFMONTH()?
27. How do you calculate the difference between two dates using DATEDIFF()?
28. How can you find the day of the week for a given date using DAYOFWEEK()?

Charts plotting questions:


1. Given the school result data, analyses the performance of the students on different
parameters, e.g subject wise or class wise.
2. For the Data frames created above, analyze, and plot appropriate charts with title and
legend.
3. Take data of your interest from an open source (e.g. data.gov.in), aggregate and summarize
it. Then plot it using different plotting functions of the Matplotlib library.

You might also like