Structured Query Language (SQL)
Structured Query Language (SQL)
Decimal places position value is rounded to the next integer if its next right side number
is>=5 Default decimal place is 0 position if we do not specify
2. Date and time functions accept date and time values as input, and return
numeric or string, or date and time values as output.
3.String functions accept character values as input, and return either
character or numeric values as output.
❖ Aggregate functions are also called multiple-row functions. These functions
work on a set of records as a whole and return a single value for each column of
the records on which the function is applied.
❖ GROUP BY in SQL -At times we need to fetch a group of rows on the basis of
common values in a column. This can be done using a GROUP BY clause. It
groups the rows together that contain the same values in a specified column.
HAVING Clause in SQL is used to specify conditions on the rows with GROUP
BY clause.
Query results will be unique occurrences of class values where class<10 along
with average marks of each class(subgroup) and descending order of marks.
Eg2)
we are having a student table with the following data.
Query result will be unique occurrences of class values along with average
marks of each class(sub group) and each class having average marks<90.
LIKE
DISTINCT
The SELECT (DISTINCT column name) statement is used to return only distinct
(different) values.
Inside a table, a column often contains many duplicate values; and sometimes you only
want to list the different (distinct) values.
NOT IN
Query- Display the details of FANS who do not belong to AJMER
Ans-
select * from FANS where FAN_CITY not in “AJMER”;
IS NULL
Query- Retrieve all details from table where customer has no accumulated amount.
Ans-
select * from CUSTOMER_DETAILS where ACCUMLT_AMT is NULL;
IN
Query- count number of students who have either accounts or informatics as subjects.
Ans-
select count(*) from STUDENT where SUBJECT in(“ACCOUNTS”,”INFORMATICS”)
NEED OF DBMS
● To manage large chunks of data
● Ease of updating data
● Security of Data
A DBMS refers to a software that is responsible for storing, maintaining and utilizing
database in an efficient way.
ADVANTAGES OF DBMS:
● Reduces redundancy
● Facilitates sharing of data
● Ensures security