
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 140 Articles for SQL

1K+ Views
The Structured Query Language (SQL) is widely used in databases to manipulate and manage data. When working with multiple tables we often need to combine or join data to retrieve meaningful information. The Two common types of joins used for this purpose are the Natural Join and the Inner Join. While both the join operations are used to combine data from two or more tables they have some differences in how they work. This article explores these differences in detail. What is an Inner Join? An Inner Join is the most commonly used join operation. It returns only those records ... Read More

114 Views
Setting a Column Value to Null To set a column value to NULL, use the SQL UPDATE statement, which allows modification of existing records in a table. The basic syntax for setting a column value to NULL is − Syntax UPDATE table_name SET column_name = NULL WHERE conditions; Where − table_name: Replace this with the name of the table you intend to update. column_name: Substitute this with the name of the column to be updated. NULL: Denotes the NULL value in SQL. ... Read More

72 Views
What is an Identity Column? The Identity column of a table is a column whose value increments consequently. This can be used to create unique identifiers, such as primary keys. Syntax Following is the syntax to create an Identity column. The initial setting for identity is represented as IDENTITY (1, 1). IDENTITY [ ( seed , increment ) ] Where − Seed: The seed determines the initial value of an ID, with a default setting of 1. Increment: This denotes the step value for ID increments, which also defaults ... Read More

4K+ Views
When we work with databases, we often need to search for the name of a Person whose name starts with a specific Letter. We can also find the names of persons whose name starts with a specific letter using SQL. This is possible by using the 'LIKE' operator in SQL, it allows us to do pattern matching on a text. Prerequisites: The following are the prerequisites to understand this tutorial - Basic SQL syntax understanding. A database management tool like MySQL, Oracle SQL or SQLite. What is 'LIKE' Operator? The ... Read More

553 Views
In real-world scenarios, you'll often need to query for the nth highest salary. Let's see how to find the second-highest salary in SQL. Example Consider a sample table named Company with columns Employee and Salary: Table Name: Company Employee ... Read More

430 Views
In SQL, date and time values are handled using specific data types, such as DATE, DATETIME, TIMESTAMP, etc. Each database management system (DBMS) may have its conventions for date formats, so understanding how to specify and use these formats is essential for working with dates in SQL. The following are the data types to handle date and time in SQL: DATE: Stores date values (year, month, day). DATETIME: Stores date and time values (year, month, day, hour, minute, second). TIMESTAMP: Stores date and time values, ... Read More

128 Views
Assume we have created a table in database and the table consists of duplicate records or, you need to check if there are multiple entries of the same record in the database. In order to find such duplicate records you can make use of below sample queries. Printing Duplicate Rows in an SQL Table Lets consider we have a table named as Students with the columns ID, Name, Age. Using the following query − CREATE TABLE Students( ID INT NOT NULL, NAME VARCHAR (20) NOT NULL, AGE ... Read More

231 Views
You can handle and manipulate date and time values within a database using SQL queries. You need to filter records based on date comparisons, like checking if a date is greater than today. We will query this using our own sample data as given below. Date Comparisons You can use various comparison operators, like >, =, and CURRENT_DATE; Here, date_column is the field containing the date values you want to compare. “CURRENT_DATE” is a keyword in SQL that represents the current date. Example Consider you have created a table named EVENTS using the CREATE TABLE statement as ... Read More

2K+ Views
In this article, we will write an SQL(Structured Query Language) query to find the Nth highest salary from a database table. We can obtain the 2nd highest salary, 3rd highest salary, and so on. Certainly, This is the most commonly asked question in an interview. There are different methods to achieve this, we will understand every technique in detail. Problem Statement Assume we have a table named employees with 3 columns namely, EmployeeId, EmployeeName and, EmployeeSalary as shown below − EmployeeId EmployeeName EmployeeSalary 10001 Mahesh 33000 10002 John 35000 10003 Abdul 34500 ... Read More

968 Views
SQL is a language which consists of different types of clauses in the Select statement like Where Group by Having Order by These clauses are used to retrieve values, sort them, group them, and do a lot of other things. In this article, we will discuss the difference between having clause and group by clause. What is Having Clause? The Having clause is used to filter groups of rows based on a condition, which often includes the aggregate functions. It comes after the GROUP BY clause in a SQL query. Unlike the WHERE clause, which filters rows before ... Read More