Category Archives: SQL

SQL SORTING Results

To fetch or display the data in sorted ascending or descending or we use SQL ORDER BY clause. And by default the ORDER BY sorting give support for Ascending order. SQL SORTING Results Syntax To use the basic ORDER BY clause follow, this syntax: SELECT column_name_x …. FROM table_name WHERE [condition] ORDER BY [column1, column2, .. columnN] [ASC |… Read More »

SQL Date Functions

SQL provides a specific data type for date-related data; there may come many cases when we require some special functions for all those dates stored in the database. For example, if we want to show the current date and time, then we can use the date NOW() Function. Different RDBMS have different date functions to perform a specific… Read More »

SQL Distinct Keyword

When we want to fetch or display unique data from the table then we use the SQL DISTINCT keyword. The only purpose of the DISTINCT keyword to eliminate the duplicate record and select only the unique ones. DISTINCT Keyword Syntax Follow this syntax to use the DISTINCT keyword: SELECT DISTINCT column1, column2, … FROM table_name; Example Consider this table of Students: +——+——–+——+——–+——-+———-+ |… Read More »

SQL Group By

If we want to fetch or display the table rows by a specific group or by similar data values then we use the SQL GROUP BY command. For instance, if there is a database table which holds the top-ranked students from the various branch and we want to display all students details according to their branch then we… Read More »

SQL DELETE Query

In SQL, to delete a specific data record or row from a table we use the DELETE command. Make sure that when you use the DELETE clause you must mention the condition which helps the DELETE command to find the specific data row. SQL DELETE Query Syntax Follow this syntax to remove a row from the table. DELETE FROM… Read More »

SQL UPDATE Query

To modify the existing table data we use the SQL UPDATE command and it works along with the SET command. The UPDATE command selects the table from the database and the SET command modify the data. When we use the UPDATE query on the table we also use the WHERE clause to filter the specific location or data set which we… Read More »

SQL AND and OR Conjunctive Operators

In SQL we have two logical operators AND & OR. These two operators operate between two condition operation and narrow down the data selection for the SQL statements. These two operators are also known as conjunctive operators. AND Operator Like the and Operators in high-level programming languages, AND operator of SQL performs a similar function, it allows the existence… Read More »