Professional Documents
Culture Documents
What is SQL ?
• Pronounced as “SeQuel”
• Refers to Structured Query Language.
• SQL is the language used to query a database in order to retrieve data from, add
data to, or, modify the data in, the database and to structure/restructure the database
itself.
Database
• A database is anything that is expected to hold data. It can be anything from your
notebook to digitally synchronized software.
• Most commonly used digital databases include MS Excel, MS Access, My SQL,
Oracle, Microsoft SQL Server.
• These databases use tables to store the data in them and are designed around the
concepts of Relational Database Management System (RDBMS).
What is AQT ?
Facts
• Field are the columns from a specified table. This a mandatory part because we need to search
something.
• Table is the warehouse where the related data is stored in defined fields. This a mandatory part
because this part tells the database that where the requested fields are located.
• Condition part is NOT mandatory while defining a Select Statement as you may need all the data
from a selected table.
• Having said Condition part is optional, keyword “Where” becomes optional, because “Where” is
only used to define conditions.
For Example:
• Data type of a field is defined when it is created in a table. The logic is same as it is in MS Access.
Select * from ps_job where emplid = ‘xxxxxxxxx’;
Points to Remember
• Basic Keywords:
And, Or, In, Like
• Keywords ‘And’ & ‘Or’ are used to define the multiple conditions.
= (equal) , > (less than), < (greater than), <> (not equal to), >= (less than or equal to), <= (greater
than or equal to)
• The above 5 operators will help you to create conditions based on exact values. For example:
emplid = ‘xxxxxxxxx’ / amount >= 500.00 / name <> ‘Jatin Sethi’ etc.
• ‘Like’ is used when we need to search data similar to what we have defined, but, not exactly
what we are defining. For Example: Search all the names starting from Alphabet ‘A’.
Operator: AND
• Fetches a row from the table if all the conditions mentioned stand true.
Example: Select * from ps_job where deptid = ‘12345’ and jobcode = ‘432456’;
• This query will fetch all the records from the Job Data table where dept. id = ‘12345’ and Job
Code = ‘432456’
Operator: OR
• Fetches a row from the table if either of the conditions mentioned stand true.
Operator: IN
• In operator is used when data needs to be fetched from a set of values.