SQL
SQL
SQL
By
P. Ramanjaneya Prasad
Associate Professor
Department of Computer Sccience
Avanthi Degree & PG College
SQL
Data ?
Data
→ Processed
→ Information
→ Knowledge
SQL
Storage of Data
→ Database
SQL
What is a Database?
A database is a collection of data that is organized, which is also called
structured data. It can be accessed or stored in a computer system.
User
↕
Database
↓
SQL
SQL
Domain Integrity : Enforces valid entries for a given column by restricting the
type, the format, or the range of values.
Referential Integrity : Rows cannot be deleted which are used by other records.
User-Defined Integrity : Enforces some specific business rules that do not fall
into entity, domain, or referential integrity.
SQL
Data Types
Numeric : Numeric Values : -1038-1 to +1038+1
Integer: -2,147,483,648 to 2,147,483,647
Float: -1.79E + 308 to 1.79E + 308
Date : Stores a date like June 30, 1991
Time : Stores a time of day like 12:30 P.M.
Char : Maximum length of 8,000 characters.( Fixed length)
Varchar : Maximum of 8,000 characters.(Variable-length).
SQL
Arithmetic Operators
SQL
Comparision Operators
SQL
Comparision Operators
SQL
Logical Operators
SQL
SQL CREATE TABLE Statement
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns ) );
SQL
SQL INSERT INTO Statement
INSERT INTO table_name( column1, column2....columnN) VALUES
( value1, value2....valueN);
Note: You may not use column names if you are entering all the values
of all fields, but should be in order.
SQL
SQL SELECT Statement Wild Cards
SELECT column1, column2 % - Matches one or more
FROM table1, table2 characters
WHERE [ conditions ]
GROUP BY column1, column2 _ - Matches one character
HAVING [ conditions ]
ORDER BY column1, column2