SQL Syntax, Data Types, SQL Operators, Literals, Types of SQL Commands, SQL Keywords, Wildcard Characters Lab 1
SQL Syntax, Data Types, SQL Operators, Literals, Types of SQL Commands, SQL Keywords, Wildcard Characters Lab 1
SQL Syntax, Data Types, SQL Operators, Literals, Types of SQL Commands, SQL Keywords, Wildcard Characters Lab 1
Objective:
To get introduce with SQL
To get introduce with SQL syntax, data types, SQL operators ,Literals, Types of SQL
commands, SQL keywords , wildcard characters.
Theory:
Structured Query Language (SQL) is a programming language that is typically used in
relational database or data stream management systems.It was developed by IBM in the early
1970s and is now an official standard recognized by the American National Standards
Institute (ANSI) and the International Organization for Standardization (ISO).
The table above contains five records (one for each customer) and seven columns (CustomerID,
CustomerName, Address, City, PostalCode, and Country).
Most of the actions you need to perform on a database are done with SQL statements.
The following SQL statement selects all the records in the "Customers" table:
SELECT * from Customers;
SQL keywords are NOT case sensitive: select is the same as SELECT
Some database systems require a semicolon at the end of each SQL statement.
Semicolon is the standard way to separate each SQL statement in database systems that allow
more than one SQL statement to be executed in the same call to the server.
SQL Operator
An operator is a reserved word or a character used primarily in an SQL statement's WHERE
clause to perform operation(s), such as comparisons and arithmetic operations. These
Operators are used to specify conditions in an SQL statement and to serve as conjunctions for
multiple conditions in a statement.
Arithmetic operators
(+,-,*,/,%)
Comparison operators
(<,>,=,!=!<,!>,<>)
Logical operators
(ALL, AND, ANY ,BETWEEN, EXIST ,IN, LIKE ,NOT ,OR ,UNIQUE ,ISNULL)
Example:
SQL Literals
There are four kinds of literal values supported in SQL. They are : Character string, Bit
string, Exact numeric, and Approximate numeric. These are explained as following below.
Character string :
Character strings are written as a sequence of characters enveloped in single quotes. the
only quote character is delineate at intervals a personality string by 2 single quotes. Some
example of character strings are :
‘My String’
‘I love DBMS’
‘6378’
Bit string :
A bit string is written either as a sequence of 0s and 1s enveloped in single quotes and
preceded by the letter ‘B’ or as a sequence of positional representation system digits
enveloped in single quotes and preceded by the letter X’ some examples are given below :
B’10001011′
B’1′
B’0′
X’C 5′
X’0′
Exact numeric :
These literals ar written as a signed or unsigned decimal variety probably with
mathematical notation. Samples of actual numeric literals are given below :
8
80
80.00
0.8
+88.88
-88.88
Approximate numeric :
Approximate numeric literals are written as actual numeric literals followed by the letter
‘E’, followed by a signed or unsigned number. Some example are :
6E6
66.6E6
+66E-6
0.66E
-6.66E-8
Conclusion :
We get introduced with mysql and its syntax , data types , operators, literals, commands, keywords,
wildcard characters and know the use case of it.