How to Insert Multiple Rows in SQL?
In many scenarios, you may require entering multiple rows by using single query of SQL. In this tutorial, I will show you how to enter two or more records by INSERT INTO statement.
In many scenarios, you may require entering multiple rows by using single query of SQL. In this tutorial, I will show you how to enter two or more records by INSERT INTO statement.
The primary key (or keyword) is used to identify each row in a relational database table. It ensures that the tables do not contain duplicate records.
The primary key consists of one or more columns that contain unique values.
I this tutorial, we will learn how to combine INSERT INTO and SELECT statements for copying the table data from one table to another.
The stored procedure is pre-compiled code of SQL statements that is stored in the database server. The stored procedures enable us writing
The SQL CHARINDEX function is used to return the position of the specified substring in a string. For example, finding the position of ‘@’ in an email address:
This UPDATE command will update whole data in the specified column by new value. For limiting the changes only to the specific records, we use UPDATE with the WHERE clause.
The SQL SUBSTRING function is used to return a part of the string by specified position. For example:
SELECT SUBSTRING(‘SUBSTRING Examples’, 1, 9);
The variables in Transact-SQL are generally used in the batch or stored procedures. The DECLARE statement is used for declaring a variable.
The SQL LIKE operator enables us searching a column by specified pattern. The LIKE uses two wildcards for performing search: (% & _)
The CREATE TABLE command is used to create new table in the Relational databases. This tutorial explains how to create new table, copy table from another table..
The data is stored in the tables in relational database management systems. In order to retrieve data from tables, we use SQL SELECT statement.
The MS SQL CONVERT function enables us changing the data type of expression from one to another. For example:
SELECT CONVERT(varchar, 50.55);
In the case of SQL Server, the IF statement is used to execute SQL statements if a condition is TRUE.
For example: IF @table_name = ’employees’
For returning the date part in a date e.g. day, month, year, hour, minute, second, day of year etc., use the SQL DATEPART function. The DATEPART function takes two arguments, for example:
The SQL LEFT JOIN fetches all the records from the left table and only matched records from the right table.