RDBMS Assignment
RDBMS Assignment
1)VIEW :
The fields in a view are fields from one or more real tables in the database.
Example
CREATE VIEW [ Pune Customers] AS
SELECT CustomerName,
FROM Customers
WHERE City = 'Pune';
Example
2)INDEX
Indexes are used to retrieve data from the database more quickly than
otherwise.
The users cannot see the indexes, they are just used to speed up
searches/queries.
CREATE INDEX Syntax
Example
CREATE INDEX idx_lastname
ON Custemers (LastName);
Example
DROP INDEX idx_lastname;
Function Description
SQL Server comes with the following data types for storing a date or a
date/time value in the database:
3 Chairs 2008-11-11
4 Beds 2008-10-29
3 Chairs 2008-11-11
2) Time functions with all-time formats.
Syntax
TIME_FORMAT(time, format)
Format Description
%p AM or PM
The TIME() function extracts the time part from a given time/datetime.
Syntax
TIME(expression)
Example
SELECT TIME(NULL);
Title : Execute SQL queries for all aggregate functions.
Aggregate Function in SQL:-An aggregate function in SQL returns one value after calculating
multiple values of a column.
Count()
Sum()
Avg()
Min()
Max()
1) COUNT() Function
2) Sum() Function
3) AVG() function
The MIN() aggregate function returns the lowest value (minimum) in a set of non-NULL
values.
5) MAX() function
The MAX() aggregate function returns the highest value (maximum) in a set of non-NULL
values.
Conclusion
The aggregate function in SQL is very powerful in the database. In this assignment , we
have seen several examples of aggregate functions.