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

Lab2 DB

The document provides an introduction to SQL (Structured Query Language), outlining its purpose, capabilities, and importance in managing relational databases. It explains SQL's functions, such as data retrieval, insertion, updating, and deletion, as well as its integration with web development through RDBMS and server-side scripting. Additionally, it details various SQL statements and operators used for database manipulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views18 pages

Lab2 DB

The document provides an introduction to SQL (Structured Query Language), outlining its purpose, capabilities, and importance in managing relational databases. It explains SQL's functions, such as data retrieval, insertion, updating, and deletion, as well as its integration with web development through RDBMS and server-side scripting. Additionally, it details various SQL statements and operators used for database manipulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Data Base (DB)

Lab2
ENG: MARWA ABDULLMANNA
Introduction to SQL

SQL (Structured Query Language) is a standardized language used to manage and manipulate
relational databases. It allows users to create, retrieve, update, and delete data efficiently.

Why Use SQL?

•Data Management: SQL helps store and organize large amounts of data.

•Easy to Learn: Simple syntax makes it beginner-friendly.

•Widely Used: SQL is used in almost every industry that deals with databases.
What is SQL?
•SQL stands for Structured Query Language

•SQL lets you access and manipulate databases

•SQL became a standard of the American National Standards Institute (ANSI)


in 1986, and of the International Organization for Standardization (ISO) in
1987
What Can SQL do?

• SQL can execute queries against a database


• SQL can retrieve data from a database
• SQL can insert records in a database
• SQL can update records in a database
• SQL can delete records from a database
• SQL can create new databases
• SQL can create new tables in a database
• SQL can create stored procedures in a database
• SQL can create views in a database
• SQL can set permissions on tables, procedures, and views
Using SQL in Your Web Site

To build a web site that shows data from a database, you will need:
•An RDBMS database program (i.e. MS Access, SQL Server, MySQL)
•To use a server-side scripting language, like PHP or ASP
•To use SQL to get the data you want
•To use HTML / CSS to style the page
RDBMS
stands for Relational Database Management System

RDBMS stands for Relational Database Management System.

RDBMS is the basis for SQL, and for all modern database systems such as MS
SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.

The data in RDBMS is stored in database objects called tables. A table is a


collection of related data entries and it consists of columns and rows
SQL Statements
•SELECT - extracts data from a database

•UPDATE - updates data in a database

•DELETE - deletes data from a database

•INSERT INTO - inserts new data into a database

•CREATE DATABASE - creates a new database


SQL Statements
•ALTER DATABASE - modifies a database

•CREATE TABLE - creates a new table

•ALTER TABLE - modifies a table

•DROP TABLE - deletes a table

•CREATE INDEX - creates an index (search key)

•DROP INDEX - deletes an index


SQL SELECT Statement

The SELECT statement is used to select data from a database.


SELECT * or Columns [alias]
FROM Table
WHERE condition or conditions
ORDER BY Column or Alias [ASC or DESC] ;
SQL SELECT Statement

Select * from dept Select deptno , dname from


dept
Aliases

SELECT ename AS name , sal salary , job "employee job " FROM
emp ;
Arithmetic Operators

SELECT ename , sal , sal*12 "annual salary" from emp


Operator Precedence

SELECT ename , sal , 12*sal+100 FROM SELECT ename , sal , 12*sal+100 FROM
emp emp
Concatenation ( + )

SELECT ENAME, JOB, ENAME + ' ' + JOB AS Employees FROM


EMP
DISTINC

SELECT deptno FROM emp SELECT DISTINCT deptno FROM emp


NULL

SELECT ename, job , sal , comm FROM emp


NULL

SELECT ename, job , sal , 12*sal+comm FROM emp


Any Question ?

You might also like