The most difficult part when working with dates is to be sure that the format of the date you are trying to insert, matches the format of the date column in the database. As long as your data contains only the date portion, your queries will work as expected. However, if a time portion is involved, it gets complicated. [Read more…] about SQL DATE Function
SQL DEFAULT Constraint
The DEFAULT constraint is used to insert a default value into a column. The default value will be added to all new records, if no other value is specified. You can also specify the DEFAULT value for columns i.e. when user does not enter anything in that column then that column will have the default value. Default constraints are ANSI -standard constraints you can assign to a column either with the CREATE TABLE or ALTER TABLE statements. [Read more…] about SQL DEFAULT Constraint
SQL EXISTS Operator
The EXISTS condition is considered “to be met” if the subquery returns at least one row. EXISTS operator simply tests whether the inner query returns any row. If it does, then the outer query proceeds. If not, the outer query does not execute, and the entire SQL statement returns nothing. [Read more…] about SQL EXISTS Operator
SQL FOREIGN KEY Constraint
A FOREIGN KEY in one table points to a PRIMARY KEY in another table. On whichever column you put FOREIGN KEY constraint then the values in that column must refer to existing values in the other table. [Read more…] about SQL FOREIGN KEY Constraint
SQL HAVING Clause
The HAVING Clause was added to SQL because the WHERE keyword could not be used with aggregate functions. As we know that WHERE clause is used to restrict the number of rows fetched from the table. But if we try to restrict the number of groups with where clause it will generate an error message. So we can use having clause to divide the groups with Group by clause. [Read more…] about SQL HAVING Clause
SQL IN Operator
The IN operator allows you to specify multiple values in a WHERE clause. The IN function helps reduce the need to use multiple OR conditions. The SQL IN clause allows you to specify discrete values in your SQL WHERE search criteria. The syntax for using the IN keyword is as follows: [Read more…] about SQL IN Operator
SQL INTERSECT Operator
Similar to the UNION command, INTERSECT also operates on two SQL statements. The difference is that, while UNION essentially acts as an OR operator (value is selected if it appears in either the first or the second statement), the INTERSECT command acts as an AND operator (value is selected only if it appears in both statements). [Read more…] about SQL INTERSECT Operator
SQL ISNULL() Function
Null is a special marker used in Structured Query Language (SQL) to indicate that a data value does not exist in the database. NULL means missing information and inapplicable information”. NULL values represent missing unknown data. By default, a table column can hold NULL values. [Read more…] about SQL ISNULL() Function
SQL LIKE Operator
Use the LIKE condition to perform wildcard searches of valid search string values. Search conditions can contain either literal characters or numbers. You can combine pattern-matching characters. You can use the ESCAPE identifier to search for the actual % and _ symbols. [Read more…] about SQL LIKE Operator
SQL MINUS Operator
The MINUS query will compare each record in statement1 to a record in statement2. The result returned will be records in Select Statement1 that are not in Select statement2. [Read more…] about SQL MINUS Operator
SQL NOT NULL
By default all columns in a table can contain null values. If you want to ensure that a column must always have a value, i.e. it should not be left blank, then define a NOT NULL constraint on it. [Read more…] about SQL NOT NULL
SQL PRIMARY KEY Constraint
The PRIMARY KEY constraint uniquely identifies each record in a database table. Primary keys must contain unique values. A primary key column cannot contain NULL values. Each table should have a primary key, and each table can have only one primary key. [Read more…] about SQL PRIMARY KEY Constraint
SQL UNION Operator
In SQL the UNION Clause combines the results of two SQL queries into a single table of all matching rows. The two queries must have the same number of columns and compatible data types to unite. Any duplicate records are automatically removed unless UNION ALL is used. [Read more…] about SQL UNION Operator
SQL UNIQUE Constraint
A UNIQUE key integrity constraint requires that every value in a column or set of columns (key) be unique-that is, no two rows of a table have duplicate values in a specified column or set of columns. [Read more…] about SQL UNIQUE Constraint
SQL WHERE Clause
The SQL WHERE Clause is used when you want to retrieve specific information from a table excluding other irrelevant data. In a where clause simple conditions based on comparison operators can be combined using the logical connectives and, or, and not to form complex conditions. Conditions may also include pattern matching operations and even subqueries. [Read more…] about SQL WHERE Clause
SQL VIEW
A VIEW is a virtual table, through which a selective portion of the data from one or more tables can be seen. Views do not contain data of their own. They are used to restrict access to the database or to hide data complexity. A view is stored as a SELECT statement in the database. DML operations on a view like INSERT, UPDATE, DELETE affects the data in the original table upon which the view is based. [Read more…] about SQL VIEW
SQL Sub Queries
Subquery or Inner Query or Nested Query is a query in a quary, A subquery is usually added in the WHERE Clause of sql statement. Most of the time, a subquery is used when you now how to search for a value using a SELECT statement, but do not know the exact value. [Read more…] about SQL Sub Queries
SQL UPDATE Query
Quite often it is required to make changes or modifications in the records of the table, so in order to make these changes, the UPDATE statement is used. With this statement, the user can modify the existing data stored in the table. It can update zero or more rows in a table. To update rows in table, it must be in your own schema or you must have update privilege on the table. [Read more…] about SQL UPDATE Query
SQL SELECT INTO Statement
The SQL SELECT INTO statement can be used to retrieves data from a table and inserts it to another database table. The SQL SELECT INTO statement used to create backup copies of tables. [Read more…] about SQL SELECT INTO Statement
SQL SELECT Statement
A select statement is used to select information from one or more tables. SQL statements can be on one or more lines. SQL is not case sensitive. SELECT is the same as select. SQL SELECT Syntax. [Read more…] about SQL SELECT Statement
PL/SQL Triggers | Types of Triggers
A trigger is a PL/SQL block structure which is fired when a DML statements like Insert, Delete, Update is executed on a database table. A trigger is triggered automatically when an associated DML statement is executed. In other words Triggers are a stored PL/SQL code block attached and executed by an event which occurs to a database table. [Read more…] about PL/SQL Triggers | Types of Triggers
SQL ORDER BY Clause
In General all the rows in the result table have not been ordered in any way. SQL just retrieved the rows in the order in which it found them in the table. Often, however, we need to list the output in a particular order. [Read more…] about SQL ORDER BY Clause
SQL GROUP BY Statement
The SQL GROUP BY clause is used along with the SQL aggregate functions and specifies the groups where selected rows are placed. When one or more aggregate functions are presented in the SQL SELECT column list, the SQL GROUP BY clause calculates a summary value for each group. [Read more…] about SQL GROUP BY Statement
SQL SELECT DISTINCT Statement
The SQL DISTINCT query is used with the SELECT keyword retrieves only unique data values depending on the fields you have specified after it. To illustrate it we use emp table as shown below. [Read more…] about SQL SELECT DISTINCT Statement
SQL DELETE Statement
The DELETE statement is used to delete rows in a table. To do so, we can use the DELETE FROM command. An SQL DELETE statement removes one or more records from a table. A subset may be defined for deletion using a condition, otherwise all records are removed. [Read more…] about SQL DELETE Statement
SQL Cursors | Types of Cursors
Oracle uses work areas to execute SQL statements and store processing information. A PL/SQL construct called a CURSOR lets you name a work area and access its stored information. A Cursor in its simplest form can be thought of as a pointer to the records in database table or a virtual table represented by the result of a SELECT statement. [Read more…] about SQL Cursors | Types of Cursors
SQL CREATE TABLE Statement
The create table statement is used to create a new table. The CREATE TABLE statement defines a table. The definition must include its name and the names and attributes of its columns. The definition can include other attributes of the table, such as its primary key or check constraints. This statement comes under the DDL statement. [Read more…] about SQL CREATE TABLE Statement
Oracle Sequence: What is Oracle Sequence in Database?
A sequence is a database object that generates numbers in sequential order. Applications most often use these numbers when they require a unique value in a table such as primary key values. Some database management systems use an “auto number” concept or “auto increment” setting on numeric column types. Both the auto numbering columns and sequences provide a unique number in sequence used for a unique identifier. [Read more…] about Oracle Sequence: What is Oracle Sequence in Database?
What is SQL?
SQL (Standard Query Language) is a language for manipulating databases developed in the 70s by IBM. All data management systems use SQL to access data or to communicate with a data server. RDBMS is the core platform for SQL, and for all other modern database languages such as Oracle, MS SQL Server, IBM DB2, MySQL, and Microsoft Access, PostgreSQL, SQLite, Firebird, and many more. SQL (Standard Query Language) is born as a result of the mathematical work of Codd, who founded the work of relational databases, three types of manipulations on the database: [Read more…] about What is SQL?