Structured Query Language
Structured Query Language
Structured Query
Language
DBMS - Architecture
Basic Terminologies - DBMS
Database : A database is an organised collection of Data
Database Management System :
With SQL, we can query our database in several ways, using English-like
statements.
With SQL, a user can access data from a relational database management
system.
It allows the user to define the data in the database and manipulate it when
needed.
SQL follows some unique set of rules and guidelines called syntax.
SQL statements are dependent on text lines. We can place a single SQL
statement on one or multiple text lines.
You can perform most of the action in a database with SQL statements.
Data types are used to represent the nature of the data that can be stored in
the database table.
For example, in a particular column of a table, if we want to store a string
type of data then we will have to declare a string data type of this column.
Data types mainly classified into three categories for every database.
String Data types
Numeric Data types
Date and time Data types
Data Types in MySQL
MySQL Data Types
A list of data types used in MySQL database. This is based on MySQL 8.0.
CHAR(Size)
It is used to specify a fixed length string that can contain numbers, letters,
and special characters. Its size can be 0 to 255 characters. Default is 1.
It is used to specify a variable length string that can
VARCHAR(Size) contain numbers, letters, and special characters. Its
size can be from 0 to 65535 characters.
Let's assume two variables "a" and "b". Here "a" is valued 50 and "b" valued 100.
+ It is used to add containing values of both operands a+b will give 150
/ It divides left hand operand by right hand operand b/a will give 2
Let's take two variables "a" and "b" that are valued 50 and 100.
< Examines the left operand value is less than right Operand, if yes (a<="" td="">
condition becomes true
>= Examines that the value of left operand is greater than or equal
to the value of right operand or not,if yes condition become true
(a>=b) is not true
<= Examines that the value of left operand is less than or equal to
the value of right operand or not, if yes condition becomes true
(a<=b) is true
!< Examines that the left operand value is not less than the right
operand value
(a!<="" td="">
!> Examines that the value of left operand is not greater than the
value of right operand
(a!>b) is true
SQL Logical Operators:
Operator Description
ALL this is used to compare a value to all values in another value set.
ANY this operator is used to compare the value in list according to the condition.
BETWEEN this operator is used to search for values, that are within a set of values
Operator Description
NOT the NOT operator reverse the meaning of any logical operator
EXISTS the EXISTS operator is used to search for the presence of a row in a
specified table