Database
Topic: Introduction
- Sumit Pendkar
Contents:
Introduction to Database
What is SQL
Arithmetic Operators and Precedence
Alias
Literal Characters
DISTINCT Keyword
Limiting the rows using WHERE clause
Character Strings, Dates and Comparison Operators
IN, LIKE, AND, OR, NOT Operators
What is a Database?
Database is a systematic collection of data. Databases support storage and manipulation
of data. Databases make data management easy.
An online telephone directory would definitely use database to store data pertaining to
people, phone numbers, other contact details, etc.
Let's also consider the Facebook. It needs to store, manipulate and present data related to
members, their friends, member activities, messages, advertisements and lot more.
Database Management System (DBMS)?
Database Management System (DBMS) is a collection of programs which enables its users
to access database, manipulate data, reporting / representation of data .
It also helps to control access to the database.
Database Management Systems are not a new concept and as such had been first
implemented in 1960s.
There are 4 major types of DBMS. Let's look into
them in detail.
Hierarchical - this type of DBMS employs the
"parent-child" relationship of storing data. This
type of DBMS is rarely used nowadays. Its
structure is like a tree with nodes representing
records and branches representing fields. The
windows registry used in Windows XP is an
example of a hierarchical database.
Configuration settings are stored as tree
structures with nodes.
Network DBMS - this type of DBMS supports
many-to many relations. This usually results in
complex database structures. RDM Server is
an example of a database management system
that implements the network model.
Relational DBMS - this type of DBMS defines database relationships in form of tables, also
known as relations. Unlike network DBMS, RDBMS does not support many to many
relationships. Relational DBMS usually have pre-defined data types that they can support.
This is the most popular DBMS type in the market. Examples of relational database
management systems include MySQL, Oracle, and Microsoft SQL Server database.
Object Oriented Relation DBMS - this type supports storage of new data types. The data to
be stored is in form of objects.
OODBMS represent significant advance over other DBMS. While other DBMS are
designed to handle structured data, an OODBMS is designed to store data from variety of
media sources, such as photographs and text, and produce work, as output, in a
multimedia format.
What is SQL?
Structured Query language (SQL) pronounced as "S-Q-L" or sometimes as "See-Quel“ is
actually the standard language for dealing with Relational Databases. In simple words its
used to talk to the data in a DBMS.
The ANSI standard language for operating relational databases.
Following are types of SQL Statements :
Data Definition Language (DDL) allows you to create objects like Schemas, Tables in the
database
Data Control Language (DCL) allows you to manipulate and manage access rights on
database objects
Data Manipulation Language (DML) is used for searching, inserting, updating, and
deleting data, which will be partially covered in this programming tutorial.
Two development environments widely used:
Primary tool is Oracle SQL Developer
SQL*Plus command line interface may also be used
Basic SELECT Statement
SELECT */ {Column1, Column2, Column3...} FROM table;
SELECT identifies the columns to be displayed.
FROM identifies the table containing those columns.
SELECT * FROM EMPLOYEES;
SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY
FROM EMPLOYEES;
Arithmetic expressions and NULL values in the SELECT statement – For Numeric
data types
Expressions with NULL Values:
Null is a value that is unavailable, unassigned, unknown, or inapplicable.
Null is not the same as zero or a blank space.
Arithmetic expressions containing a null value evaluate to null.
Defining a Column Alias
A column alias:
Renames a column heading
Is useful with calculations
Immediately follows the column name (There can also be the optional ‘AS’ keyword
between the column name and alias.)
Requires double quotation marks if it contains spaces or special characters, or if it is
case-sensitive
Literal Character Strings
• A literal is a character, a number, or a date that is included in the SELECT statement.
• Date and character literal values must be enclosed within single quotation marks.
• Each character string is output once for each row returned
Alternative Quote (q) Operator
• Specify your own quotation mark delimiter.
• Select any delimiter.
• Increase readability and usability.
QUIZ:
Thank You..!!