Professional Documents
Culture Documents
&
CS2082 Database Management Systems
Laboratory
(LAB-5)
Commutative Property – 𝑅1 ∪ 𝑅2 = 𝑅2 ∪ 𝑅1
BETWEEN NUMBER/TEXT/DATES The BETWEEN operator in SQL is used to get values within a
range.
LIKE STRING The LIKE operator in SQL is used to search for character string
with the specified pattern using wildcards in a column.
EXISTS BOOLEAN It returns TRUE if the subquery returns one or more records.
SOME/ALL BOOLEAN Returns TRUE if ALL of the subquery values meet the condition.
/ANY
IN()
The IN operator in SQL is used to search for specified value matches
any value in set of multiple values.
The SQL Server IS NULL operator is used to test for a NULL value. It can
be used with SELECT, INSERT and UPDATE .
SELECT COLUMN
SELECT * FROM
NAME…|EXP_1 FROM
TEACHING WHERE
TABLE NAME WHERE EXP_2 Age > ANY
COMP_OPERATOR {ANY} (SELECT Age
(SUBQUERY) FROM
NONTEACHING);
SOME()
The SOME Operator in SQL Server is used to compare a value to
each value in a list of results from a query and evaluate to true if the
result of an inner query contains at least one row.
SELECT COLUMN
SELECT * FROM
NAME…|EXP_1 FROM
TEACHING WHERE
TABLE NAME WHERE EXP_2 Age > SOME
COMP_OPERATOR {SOME} (SELECT Age
(SUBQUERY) FROM
NONTEACHING);
EXIST()
The SQL Server EXISTS operator is used in combination with a
subquery and is considered to be met if the subquery returns at least
one row. It can be used in a SELECT, INSERT, UPDATE, or DELETE
statement.
SELECT COLUMN
NAME…|EXP_1 FROM SELECT * FROM TEACHING
WHERE EXISTS (SELECT *
TABLE NAME WHERE EXP_2
FROM CONTACT WHERE
COMP_OPERATOR {SOME} TEACHING.EId =
(SUBQUERY) CONTACT.EmployeeID);
Why Date and Time Function?
To ensure that the date and time module is accessible while
creating and accessing a database.
Date and Time Function in SQL Server
The date and time function in SQL server allows us to handle date
and time data effectively.
DATE: YYYY-MM-DD
YEAR: YYYY or YY
Date and Time Functions
Returning the System Date and Returning the Modify Date and Time
Time Values Values
Returning the Date and Time Parts SET or Return Session Format
Functions
Returning the Date and Time Values Returning the Validate Date and
from Their Parts Time Values
GETUTCDATE() This function is used to get the current UTC date and time values as an
integer.
GETDATE() This function is used to get the system's current date and time on which the
SQL Server is installed.
SYSDATETIME() This function is used to get the system's current date and time with more
fractional second precision without including the time zone offset.
SYSUTCDATETIME() This function is used to get the system's current date and time value based on
the UTC timestamp as an integer.
System Date and Time Values
SELECT CURRENT_TIMESTAMP AS Date;
YEAR() This function is used to get the year value from the
input dates as an integer.
DATENAME()
DATENAME() function is used to extract the part of the date such
as day, month, or year.
YEAR('2012/05/17') AS Result2;
Date and Time Difference
DATEDIFF()- This function is used to get the difference in a date
part of the two input dates values.
This function returns the last day of the month for a specified
date.
EOMONTH('2021-02-22') AS end_of_feb2021;
IS DATE()
This function is used to check the entered dates follows the
standard format of date, time, or datetime value or not.
ISDATE('2020-15-06') AS Result2;
THANK YOU!