Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
263 views

SQL Practical File

The document provides examples of SQL statements for performing various operations on database tables like creating, inserting, updating, deleting records and tables. It also includes statements for aggregation, math functions, constraints, views and joins.

Uploaded by

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

SQL Practical File

The document provides examples of SQL statements for performing various operations on database tables like creating, inserting, updating, deleting records and tables. It also includes statements for aggregation, math functions, constraints, views and joins.

Uploaded by

Ashika Kariwal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 42

1. Write SQL Statement to create Database Table.

2. Write SQL Statement to Insert Table Values.

1
3. Write SQL Statement to Update Table record using WHERE clause.

2
4. Write SQL Statement to Delete Table records.

5. Write SQL Statement to Drop table Using Drop Command.

3
6. Write SQL Statement to create database using Distinct Operator.

7. Write SQL Statement to arrange the Column Value in Ascending or


Descending order using Order by Clause.

4
8. Write SQL Statement to delete a particular row from Table using LIKE
operator.

5
9. Write SQL Statement for Selected Rows and all Columns.

10. Write SQL Statement for Selected Rows and Selected Columns.

6
11. Write SQL Statement to Update or Change data Value in a Table.

7
12. Write SQL Statement to Add New Column Using ALTER Command.

8
13. Write SQL Statement to Drop Column from Table.

9
14. Write SQL Statement to Drop Table.

15. Write SQL Statement to modify existing Columns.

10
16. Write SQL Statement to change the name of Table using RENAME
Command.

17. Write SQL Statement to change Column name using ALTER Table Clause.

11
18. Write SQL Statement to Truncate Table.

12
19. Write SQL Statement to display Table Structure.

20. Write SQL Statement to find out Tables created by users.

13
Program: 21
Aim: write SQL Statement to return average value.
Source code: Using SQL
Output:

14
15
Program: 22
Aim: write SQL Statement to return minimum value.
Source code: Using SQL
Output:

16
Program: 23
Aim: write SQL Statement to return maximum value.
Source code: Using SQL
Output:

17
Program: 24
Aim: write SQL Statement to return the number of rows where expression is not NULL.
Source code: Using SQL
Output:

18
Program: 25
Aim: write SQL Statement to return the sum of values.
Source code: Using SQL
Output:

19
Program: 26
Aim: write SQL Statement to return the number of rows in the table including duplicate and
those with NULL values.
Source code: Using SQL
Output:

20
Program: 27
Aim: write SQL Statement to return the number absolute values.
Source code: Using SQL
Output:

21
Program: 28
Aim: write SQL Statement to return m raise to power n.
Source code: Using SQL
Output:

22
Program: 29
Aim: write SQL Statement to return round value.
Source code: Using SQL
Output:

23
Program: 30
Aim: write SQL Statement to return square root.
Source code: Using SQL
Output:

24
Program: 31
Aim: write SQL Statement to return exponential function.
Source code: Using SQL
Output:

25
Program: 32
Aim: write SQL Statement to find greatest number.
Source code: Using SQL
Output:

26
Program: 33
Aim: write SQL Statement to find least number.
Source code: Using SQL
Output:

27
Program: 34
Aim: write SQL Statement to find mod of values.
Source code: Using SQL
Output:

28
Program: 35
Aim: write SQL Statement to use ‘IS NOT NULL’ constraint.
Source code: Using SQL
Output:

29
Program: 36
Aim: write SQL Statement to use ‘IS NULL’ constraint.
Source code: Using SQL
Output:

30
Program: 37
Aim: write SQL Statement to use ‘Default’ constraint.
Source code: Using SQL
Output:

31
Program: 38
Aim: write SQL Statement to use ‘Unique’ constraint.
Source code: Using SQL

Output:

32
Program: 39
Aim: write SQL Statement to use ‘Primary Key’ constraint.
Source code: Using SQL
Output:

33
Program: 40
Aim: write SQL Statement to use ‘Foreign Key’ constraint.
Source code: Using SQL
Output:

34
Program: 41
Aim: write SQL Statement to use ‘Check’ constraint.
Source code: Using SQL
Output:

35
Program: 42
Aim: write SQL Statement to use ‘INDEX’ constraint.
Source code: Using SQL
Output:

36
Program: 43
Aim: write SQL Statement to create View.
Source code: Using SQL
Output:

37
Program: 44
Aim: write SQL Statement to update View.
Source code: Using SQL
Output:

38
Program: 45
Aim: write SQL Statement to Drop View.
Source code: Using SQL
Output:

39
Program: 46
Aim: write SQL Statement to use Order by clause.
Source code: Using SQL
Output:

40
Program: 47
Aim: write SQL Statement to use Group by clause.
Source code: Using SQL
Output:

41
Program: 48
Aim: write SQL Statement to perform join operation.
Source code: Using SQL
Output:

42

You might also like