DBMS Notes
DBMS Notes
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.
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.
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.
2
20CS2016L – Database Systems Lab URK22CS7008
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.