SQL notes for learning Database, Study notes of Database Management Systems (DBMS)

Structures query language notes

Typology: Study notes

2017/2018

Uploaded on 11/16/2018

jansky9536
jansky9536 🇮🇳

1 document

1 / 285

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SQL
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download SQL notes for learning Database and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

SQL

What is SQL?

• SQL stands for Structured Query Language

• SQL is a standard language for storing,

manipulating and retrieving data in databases.

• SQL lets you access and manipulate databases

• SQL is an ANSI (American National Standards

Institute) standard

  • (^) SQL is a language that all commercial RDBMS

implementations understand.

  • SQL is a non-procedural language
  • We would be discussing SQL with respect to

oracle syntax

How SQL Works?

  • (^) DDL (Data Definition Language)
    • (^) Create - Creates a new table, a view of a table, or other object in the database.
    • (^) Alter - Modifies an existing database object, such as a table.
    • (^) Drop - Deletes an entire table, a view of a table or other objects in the database.
    • (^) Truncate - Is used to delete complete data from an existing table. SQL Statements
  • (^) DML (Data Manipulation Language)
    • (^) Insert - Creates a record.
    • (^) Update - Modifies records.
    • (^) Delete - Deletes records.
    • (^) Select - Retrieves certain records from one or more tables. SQL Statements
  • (^) TCL (Transaction Control Language)
    • (^) Commit - To save the changes.
    • (^) Rollback - To roll back the changes. SQL Statements

Data types Data Type Explanation Char (size) Where size is the number of characters to store. Fixed length strings. Space padded. The maximum number of characters this data type can hold is 255 characters. Varchar(size)/ varchar2(size) Where size is the number of characters to store. variable length strings. Date Standard format is DD – MON – YY Number(p , s) Where p is the precision ands is the scale. For ex. Number(7,2) is a number that has 5 digits before the decimal and 2 digits after the decimal.

DDL(Data Definition Language)

Creating and Managing Tables

Database Objects

What is a table?

• The data in an RDBMS is stored in database

objects which are called as tables. This table is

basically a collection of related data entries

and it consists of numerous columns and rows.

• Remember, a table is the most common and

simplest form of data storage in a relational

database. The following program is an example

of a CUSTOMERS table −

What is a field?

• Every table is broken up into smaller entities

called fields. The fields in the CUSTOMERS

table consist of ID, NAME, AGE, ADDRESS and

SALARY.

• A field is a column in a table that is designed

to maintain specific information about every

record in the table.

What is a Record or a Row?

• A record is also called as a row of data is each

individual entry that exists in a table. For

example, there are 7 records in the above

CUSTOMERS table.

1 Ramesh 23 Ghaziabad 22,