0% found this document useful (0 votes)
3 views3 pages

SQL Notes

The document provides an overview of databases and Database Management Systems (DBMS), explaining their functions and types, including relational (RDBMS) and non-relational databases. It introduces SQL as the programming language used to interact with relational databases, detailing CRUD operations and the structure of tables. Additionally, it outlines SQL data types and various types of SQL commands, including DQL, DDL, DML, DCL, and TCL.

Uploaded by

Dolly Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

SQL Notes

The document provides an overview of databases and Database Management Systems (DBMS), explaining their functions and types, including relational (RDBMS) and non-relational databases. It introduces SQL as the programming language used to interact with relational databases, detailing CRUD operations and the structure of tables. Additionally, it outlines SQL data types and various types of SQL commands, including DQL, DDL, DML, DCL, and TCL.

Uploaded by

Dolly Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL

DATABASE: Collection of data in a format that can easily accessed


DATABASE MANAGEMENT SYSTEM: A software application used to manage our database is
DBMS . managing data means add, Delete, update, modify, search.
User can’t directly access database , so for this there is a layer in between them and that is
DBMS, then DBMS do the work in backend, so we use SQL to interact with DBMS.
DBMS is of two types : relational , non relational
Relational Database Management System (RDBMS): Data stored in Tables. Example: MySql,
Microsoft sql server, Oracle server
Non Relational: Data not stored in tables. Usually called NOSQL because they don’t
understand SQL . E xample: Mongodb

What is SQL?
Structured Query Language, it helps to talk with databases. SQL is a programming language
used to interact with relational databases.
It is used to perform CRUD operations:
Create
Read
Update
Delete

What is table?
Combination of rows and columns. Columns tells us the general structure (in database
language it is called schema=database design , column will tell the design which means what
is stored in it and rows tells individual data).

Creating our first database


CREATE DATABASE db_name ;
DROP DATABASE db_name ;

CREATING OUR FIRST TABLE


USE db_name;
CREATE TABLE table_name (
Column_name1 datatype constraint,
Column_name2 datatype constraint,
Column_name3 datatype constraint
);
EXAMPLE : CREATE TABLE student (
id INT PRIMARY KEY,
NAME VARCHAR (50),
age INT NOT NULL
);

To check the table :


Select * from table_name ;

SQL DATATYPES
DATATYPE DESCRIPTION EXAMPLE

CHAR FIXED LENGTH STRING(0-255) CHAR(3)= ‘ABC’

VARCHAR VARIABLE LENGTH STRING(0-255) VARCHAR(10)= ‘APPLE’

BLOB BINARY LARGE OBJECT, STORES BINARY DATA

INT STORES WHOLE NUMBER 10,30

FLOAT STORES DECIMAL NUMBERS 3.14

BOOLEAN STORES TRUE / FALSE

DATE STORES DATE VALUES DD-MM-YYYY

TIME STORES TIME VALUES ’14:30:00’

YEAR STORES YEAR ‘2004’


TYPES OF SQL COMMANDS
DQL (DATA QUERY LANGUAGE): USED TO RETREIVE DATA FROM DATASET
(SELECT)
DDL (DATA DEFINITION LANGUGAGE ): USED TO CREATE, ALTER, DELETE, DROP,
RENAME, TRUNCATE DATABASE OBJECTS
DML (DATA MANIPULATION LANGUAGE) : USED TO MODIFY DATABASE (INSERT,
UPDATE, DELETE)
DCL (DATA CONTROL LANGUAGE): USED TO GRANT AND REVOKE PERMISSION
TCL (TRANSACTION CONTROL LANGUAGE): USED TO MANAGE TRANSACTION
(COMMIT, ROLLBACK, START TRANSACTION, SAVEPOINT)

You might also like