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

DBMS Notes

DBMS NOTES HAND WRITTEN

Uploaded by

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

DBMS Notes

DBMS NOTES HAND WRITTEN

Uploaded by

imviswanthanss
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

20CS2016L – Database Systems Lab URK22CS7008

Ex no: 3 ADVANCED SQL COMMANDS

Date 20-08-24

AIM:
To execute advanced sql commands and get the desired output.

DESCRIPTION:
Aggregate Functions: SQL aggregate functions operate on the multiset of values of a column of a
relation, and return a Value. The various aggregate functions are: Sum(), avg(), count(), min(), max().
Distinct Keyword: To eliminate the duplicates, the keyword distinct is used in the aggregation
expression. SQL does not allow the use of keyword distinct with count (*) to count the number of
records in a relation.
GROUP BY Clause: To apply aggregate function to a group of sets of tuples. The attributes given in
the group by clause are used to form groups.
ORDER BY Clause: This clause causes the tuples in the result of a query to appear in sorted order.
We specify asc for ascending order and desc for descending order.

QUERIES AND OUTPUT SCREENSHOT:


1. Find the average price of confirmed tickets.

2. Display the starting date as “Start” of all the events from events table.
20CS2016L – Database Systems Lab URK22CS7008

3. Find the Minimum date, maximum date of all the events, and the number of months in
between the min and max dates.

4. Find the total number of venues used to conduct the events.

5. Find the number of users in User table.

6. Find the length of password of User = p@ssw0rd from User table.

7. Concatenate the data and time of Event table as “Date-Time” and display Date-Time and the
name of the event if the 5th character of event name is ‘e’.

8. Find the user names whose name ends with “pez” from user table.

9. Left pad the seat number of Ticket table with “000”.

2
20CS2016L – Database Systems Lab URK22CS7008

10. Display the event details conducted at the same Venue_ID.

11. Find out the number of venues in each country from Venue table.

12. Add a column named “Remarks” in Venue table. Fill the remarks column with “No Remarks”
values using NVL2 command. Print Venue_ID, Country, and Remarks column.

13. Use round and trunc functions to round off and truncate the value 25.235789 to 2 decimal
positions using dual table.

3
20CS2016L – Database Systems Lab URK22CS7008

14. Prefix price column with a value of 0 in ticket table to make the length of price =10 digits.

15. Retrieve all events ordered by date and time in ascending order.

RESULT:
The tables were created and Advanced SQL commands were executed successfully.

You might also like