#ORACLE SQL
#ORACLE SQL
Projection
SELECT colN1,colN2,.. FROM Table_Name WHERE condition;
------------------------------------------------------------------
SELECTION
SELECT * FROM TableName WHERE condition
-------------------------------------------------------------------
SQL Keywords are case-insensitive but usually written in all capitals
-KeyWords are case insensitive
-Table Names in SQL are case insensitive
-colName Names in SQL are case insensitive
-DATA in SQL are case sensitive
---------------------------------------------------
Column alias
-columnName as aliasname
or
-columnName "alias name"
alias names will never be reflected in the actual tables present on the hard
drive of computer
------------------------------------------------------
DISTINCT Keyword
-used after SELECT to eliminate duplicate records and fetch only unique
records.
You can also check arithmetic calculation from the dual table using the
following statement:
SELECT 13+23*43/20 FROM DUAL;
--------------------------------------------------------------------
Operators as keywords
1. RELATION OPERATORS: = > < >= <= (!= <> ^=) in order with their precedence
2. BETWEEN AND Operator:
-when condition has a range of values to be compared we should be using
BETWEEN AND operator.
-Ex: SELECT * FROM student WHERE MARKS BETWEEN 80 AND 90;
3.IN
-When ever comparison has to be done with respect to a set of values we
have to use the IN operator.
SELECT * FROM student Where AGE IN (20,22);
4. LIKE:
-used to search for a specified pattern in a column.
-NOTE: pattern matching in SQL:
1. %(modulus): it matches 0 or more characters.
SELECT * FROM student WHERE NAME LIKE 'RA%';
2._(Under score): it matches exactly one character.
SELECT * FROM student WHERE NAME LIKE '___R%';// will give
word whose 4th character is R.
5. IS NULL
-used to select only the records with NULL values in the column.
-Ex SELECT * FROM student WHERE AGE IS NULL;
6. LOGICAL OPERATOR:
1.AND
2.OR
3.NOT
---------------------------------------------------------------
FUNCTIONS IN ORACLE: