INSERT Statement in SQL Databases
For populating new data into the SQL database tables, you may use the INSERT INTO statement. The SQL INSERT INTO statement allows you entering the data in two ways.
For populating new data into the SQL database tables, you may use the INSERT INTO statement. The SQL INSERT INTO statement allows you entering the data in two ways.
The SQL DELETE command is used to remove the records from the relational database tables permanently. For example: DELETE FROM table_name;
The “OR” is a logical operator in SQL that is used to combine two or more conditions in the WHERE clause. The WHERE clause with OR operator can be used with SELECT, UPDATE, INSERT and DELETE statements.
The IN operator enables you providing a list of values to be tested in the WHERE clause (generally) with SELECT, DELETE, or UPDTAE statements.
What is SQL WHERE clause? The simple SELECT statement returns all records from the table(s) in an SQL database. For example: SELECT * FROM tbl_name; In order to return only filtered records or rows that fulfill certain criteria, the SQL WHERE clause is used in the SELECT statement. For example: SELECT * FROM tbl_name Where … Read more
You may use SQL CAST and CONVERT functions for converting int to string and vice versa. Both these functions are little different to use.
In MS SQL Server, the DATEDIFF function is used to get the difference between two dates in terms of years, months, days, hours, minutes. e.g. SELECT DATEDIFF(day, ‘2018-03-13’, GETDATE()) AS “Difference in days”;
The SQL ISNULL function enables you replacing the NULL values with the specified value as retrieving data from the SQL Server database.
The SQL GETDATE function returns the current date and time. For example: SELECT GETDATE() AS “Date & Time”;
The REPLACE function in SQL is used for replacing all occurrences of in the specified string to the new given string value.
The CONCAT function is used to combine or concatenate two or more string values. The CONCAT takes at least two arguments, that are converted to strings (if they are not already) and returns a concatenated string.
The INNER join returns the records of matched values in both tables that are joined.
On the contrary, the OUTER JOIN returns all records from both tables.
The SQL EXISTS is an operator that is used with the WHERE clause that tests the existence of rows by using a subquery.
If that subquery in the EXISTS contains any row, it returns TRUE.
The SQL has different clauses for fetching top records as using the SELECT statement. Different databases like MS SQL Server, MySQL and Oracle has different clauses for getting top records.
The SQL HAVING clause is generally used with the GROUP BY clause for specifying a condition for a group or aggregate.