Introduction To Structured Query Language (SQL)

Slides:



Advertisements
Similar presentations
1 Başar Öztayşi 2011 END 213E Data Processing in Industrial Systems SQL Structured Query Language.
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
Virtual training week 4 structured query language (SQL)
Introduction to Structured Query Language (SQL)
SQL Basics Based on the relational algebra we just learned. Nonprocedural language – what to be done not how Simple, powerful language Used for both data.
Introduction to Structured Query Language (SQL)
1ISM - © 2010 Houman Younessi Lecture 3 Convener: Houman Younessi Information Systems Spring 2011.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Intro to JDBC To effectively use Java Data Base Connectivity we must understand: 1.Relational Database Management Systems (RDBMS) 2.JDBC Drivers 3.SQL.
LOGO 1 Lab_02: Basic SQL. 2 Outline  Database Tables  SQL Statements  Semicolon after SQL Statements?  SQL DML and DDL  SQL SELECT Statement  SQL.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
Structured Query Language. SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems.
Database A collection of related data. Database Applications Banking: all transactions Airlines: reservations, schedules Universities: registration, grades.
Sundara Ram Matta Apr 01 st, Sundara Ram Matta Apr 01 st, 2015
Data Access Basics Intro to basic SQL. Have you used SQL? Yes No Es Que What?
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
1 What is database 2? What is normalization? What is SQL? What is transaction?
Structure Query Language SQL. Database Terminology Employee ID 3 3 Last name Small First name Tony 5 5 Smith James
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan.
DAT602 Database Application Development Lecture 3 Review of SQL Language.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
SQL. คำสั่ง SQL SQL stands for Structured Query Language is a standard language for accessing and manipulating databases.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
Lab_03: Basic SQL.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
CHAPTER 9 SQL อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
WEEK# 12 Haifa Abulaiha November 02,
Chapter 11 Database and SQL. Flat Files and Databases Flat files Databases Advantages Efficient use of resources Access control Disadvantages Security.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Manipulating Data Lesson 3. Objectives Queries The SELECT query to retrieve or extract data from one table, how to retrieve or extract data by using.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 5: SQL I Rob Gleasure robgleasure.com.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
Introduction to Database SEM I, AY Department of Information Technology Salalah College of Technology Chapter No.3 SQL.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
Lec-7. The IN Operator The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE.
SQL Structured Query Language. SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database.
COM621: Advanced Interactive Web Development Lecture 11 MySQL – Data Manipulation Language.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
Web Systems & Technologies
Module T03d Software Engineering
From: SQL From:
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Query Methods Simple SQL Statements Start ….
SQL Query Getting to the data ……..
Query Methods Where Clauses Start ….
 2012 Pearson Education, Inc. All rights reserved.
Introduction to Structured Query Language(SQL)
SQL Implementation & Administration
Structured Query Language – The Basics
SQL Tutorial.
Introduction To Structured Query Language (SQL)
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
Database systems Lecture 3 – SQL + CRUD
Database Design and Development
SQL Queries Chapter No 3.
SQL.
SQL .. An overview lecture3.
Structured Query Language – The Fundamentals
Structured Query Language
PHP and MySQL.
Manipulating Data Lesson 3.
Presentation transcript:

Introduction To Structured Query Language (SQL)

SQL SQL is a standard language for accessing databases. Our SQL tutorial will teach you how to use SQL to access and manipulate data in: MS Access SQL Server database systems.

What is SQL? SQL stands for Structured Query Language SQL lets you access and manipulate databases SQL is an ANSI (American National Standards Institute) standard

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

Some of The Most Important SQL Commands 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 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

Student

SELECT Statements In this tutorial we will use the well-known sample database (included in MS Access and MS SQL Server). The following SQL statement selects all the records in the table: Statement: SELECT * FROM Table; E.g.: SELECT * FROM Student;

SELECT Statements SELECT column_name,column_name FROM table_name; Select id, Firstname, age From Student;

SQL SELECT DISTINCT Statement The SELECT DISTINCT statement is used to return only distinct (different) values. SELECT DISTINCT column_name,column_name FROM table_name;

SQL WHERE Clause The WHERE clause is used to filter records. SELECT * FROM Student WHERE Field_Name ="Text Value"; SELECT * FROM Student WHERE Field_Name =Numeric Value;

Operators in The WHERE Clause Description = Equal <> Not equal. Note: In some versions of SQL this operator may be written as != > Greater than < Less than >= Greater than or equal <= Less than or equal BETWEEN Between an inclusive range LIKE Search for a pattern IN To specify multiple possible values for a column

AND & OR Operators The AND & OR operators are used to filter records based on more than one condition. SELECT * FROM Student WHERE City =Nizwa" AND Age < 30; SELECT * FROM Student WHERE City =Nizwa" OR Age < 30; SELECT * FROM Student WHERE City=Nizwa" AND (lastname= "said" OR firstname="ali");

Operators in The WHERE Clause The BETWEEN operator selects values within a range. The values can be numbers, text, or dates. SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2; Not Between used to NOT Include SELECT Firstname, Lastname, city, age FROM student WHERE city NOT BETWEEN "Muscat" AND "Izki";

IN Operator The IN operator allows you to specify multiple values in a WHERE clause. SELECT column_name(s) FROM table_name WHERE column_name IN (value1,value2,...);

LIKE Operator The LIKE operator is used to search for a specified pattern in a column. SELECT * FROM Student WHERE City LIKE "s*";

ORDER BY Keyword The ORDER BY keyword is used to sort the result-set. SELECT * FROM student ORDER BY city; SELECT * FROM student ORDER BY city ASC /DESC; SELECT * FROM student ORDER BY city, firstname; SELECT * FROM student ORDER BY city ASC, lastname DESC;

INSERT INTO Statement The INSERT INTO statement is used to insert new records in a table. INSERT INTO Student(FirstName, LastName, City, age, Mob) VALUES (‘Nour',Elshaiekh',Halfa',42, 5654566);

UPDATE Statement The UPDATE statement is used to update records in a table. UPDATE Student SET LastName= “Mussab”, City= “Suhar” WHERE FirstName= “Ali”;

Delete Statement The DELETE statement is used to delete records in a table. DELETE FROM Student WHERE FirstName="Ali" AND LastName="Said" ;

SELECT TOP Clause The SELECT TOP clause is used to specify the number of records to return. SELECT TOP 2 * FROM Student;

SELECT TOP Clause SQL statement selects the first ?% of the records from the table: SELECT TOP 20 PERCENT * FROM Student;

SQL JOIN An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them. SELECT abs.name, Student.FirstName, ab.age FROM student INNER JOIN ab ON ab.Name=student.FirstName;

SQL Aliases SQL aliases are used to give a database table, or a column in a table, a temporary name. Basically aliases are created to make column names more readable. SELECT FirstName AS CEMIS FROM Student;

The SQL UNION Operator The UNION operator is used to combine the result-set of two or more SELECT statements SELECT FirstName FROM Student UNION SELECT FirstName FROM ab; SELECT City FROM Student SELECT FirstName From ab ORDER BY City;