Category Archives: SQL

SQL Indexes

SQL query works fast on a small data sets or table with less number of rows, but in the real world database table contains millions of rows and hundreds of tables and we if try to apply a search query on a table which contains millions of rows then the SQL engine would take a lot of time… Read More »

SQL Alias Syntax

The SQL alias is used to change the table or column name temporary, during a query. To use the Alias in SQL we use the AS clause followed by the temporary name. The main use of Aliases clauses to make a column and table name more readable. SQL Alias Syntax The life of the Alias temporary name change… Read More »

SQL NULL Values

The NULL value represents no value or black value. For instance, suppose there is a table which stores students first name and last name, if any student does not have any last name then the last name column for that student will remain blank and that blank cell in the SQL table will be represented by a NULL… Read More »

SQL UNIONS CLAUSE

The SQL UNION clause is used to combine the result table of two or more than two select statements by eliminating the duplicate data records or rows. SQL UNIONS CLAUSE We can only use the UNION operator between two SELECT statements if they follow the following criteria: Both the SELECT statements have the same number of Columns. The… Read More »

SQL JOINS

JOIN is one of the most powerful and used commands in SQL, JOINS are used to combine rows from two or more tables from the same database and while we join the tables there should be a relation between both the tables. We use JOIN when we want to fetch data from two tables and wants to see… Read More »

SQL Constraints

Constrains are the special rules which restrict the limits of the column data values, constrains often used when we want a column data values to follow a specific set of rule. It’s always a good practice to mention the column constrain if necessary because it increases the data reliability and accuracy. SQL Constraints As we know that constraints… Read More »

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 »