SQL Truncate

This command deletes all records from table. Truncate is a DDL command. Syntax:

Example:

ORDER BY The ORDER BY clause arranges the table or column in ascending or descending orders. By default, it is ascending order. ‘ASC’ used to indicate ascending order and ‘DESC’ used to indicate descending order.  To appear the resulting …

Read moreSQL Truncate

Categories sql

SQL Operators

Arithmetic Operators Arithmetic operators are +, -, *, /, % performs addition, subtraction, multiplication, division, modulo respectively. Example:   Select 100+222; Select salary+100 From teacher Where teacher_id=1; Following output screen shows different arithmetic operations. We can perform single operation at a time or multiple operations. Comparison Operators Comparison operators ‘<’,   ‘<=’, ‘>’, >, =’, =’ …

Read moreSQL Operators

Categories sql

SQL Scalar Functions

TEACHER Table LCASE() Function The LCASE() function is used to return lower case values of specified column. Syntax: Select Lcase(column_name) from table_name; Example: Select Lcase(teacher_name) from teacher; Syntax: Select Lcase(column_name) from table_name [where condition]; Example: Select Lcase(teacher_name) from teacher where teacher_id=1; UCASE() Function The UCASE() function is used to return values in upper case of …

Read moreSQL Scalar Functions

Categories sql

SQL Aggregate Functions

Max() Function The Max() function returns the maximum value of specified column. Syntax: Select Max(column_name) From table_name; Example: Select Max(salary) From teacher; Min() Function The Min() function returns the minimum value of specified column. Syntax: Select Min(column_name) From table_name; Example: Select Min(salary) From teacher; Sum() Function The Sum() function is used to perform addition on …

Read moreSQL Aggregate Functions

Categories sql

SQL CONSTRAINTS

SQL Constraints specifies the rules/limitations/restrictions for data present in table. SQL Constraints are specified at the time of table creation or after table creation using ALTER command. There are two types of constraints column-level constraint and table-level constraint. As the name column level specifies, it specifies a particular column. In a table level constraint, it …

Read moreSQL CONSTRAINTS

Categories sql

SQL Commands

SQL commands are classified into four groups on the basis of their nature. DDL (Data Definition Language) DML (Data Manipulation Language) DCL (Data Control Language) DQL (Data Query Language)   NOTE: This symbol ‘[ ] ‘indicates optional. SQL is not a case sensitive language.

Categories sql