Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  Basic SQL syntax  Data retrieve  Data query  Data conditions  Arithmetic operations on data  Data transactions.

Similar presentations


Presentation on theme: "Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  Basic SQL syntax  Data retrieve  Data query  Data conditions  Arithmetic operations on data  Data transactions."— Presentation transcript:

1 Assoc. Prof. Dr. Ahmet Turan ÖZCERİT

2  Basic SQL syntax  Data retrieve  Data query  Data conditions  Arithmetic operations on data  Data transactions You will learn: 2

3 He/she can use SQL instructions to create and manage database tables 3 SQL is an ANSI and ISO standard (since 1986) computer language for creating and manipulating databases SQL allows the user to create, update, delete, and retrieve data from a database SQL is very simple and easy to learn SQL works with database programs like DB2, Oracle, MS Access, Sybase, MS SQL Server etc. SQL is a keyword based language. Each statement in SQL begins with a unique keyword. These keywords are not case-sensitive. SQL Instructions can be grouped in Data Defining Language Data Manipulation Language Data Control Language Transaction Control Language Data Query Language Some instructions can be executed directly in SQL editor or they can be implemented by GUI of the DBMS

4 He/she can use SQL instructions to create and manage database tables 4 SELECT selects the fields in the tables SELECT * FROM table_name (selects all fields and all rows or records)

5 He/she can use SQL instructions to create and manage database tables 5 SELECT OrtakNo, Ad, Soyad from Zkimlik1

6 He/she can use SQL instructions to create and manage database tables 6 SELECT * FROM Zkimlik1 ORDER BY Ad

7 He/she can use SQL instructions to create and manage database tables 7 SELECT * FROM Zkimlik1 ORDER BY Ad DESC

8 He/she can use SQL instructions to create and manage database tables 8 SELECT * FROM Zkimlik1 ORDER BY Ad,Soyad

9 He/she can use SQL instructions to create and manage database tables 9 SELECT * FROM Zkimlik1 WHERE ad=”AHMET”

10 He/she can use SQL instructions to create and manage database tables 10 SELECT * FROM Zkimlik1 WHERE Ad=”AHMET” OR Soyad=”MERT”

11 He/she can use SQL instructions to create and manage database tables 11 SELECT * FROM Zkimlik1 WHERE ad BETWEEN “AYDIN” AND “BEKİR”

12 He/she can use SQL instructions to create and manage database tables 12 SELECT * FROM zkimlik1 WHER ad IN('Ali','Bekir')

13 He/she can use SQL instructions to create and manage database tables 13 SELECT * FROM ZKimlik1 WHERE adi LIKE ‘*C*’

14 He/she can use SQL instructions to create and manage database tables 14 SUM : Addition of all records MAX: Maximum value in the records MIN: Minimum value in the records AVG: Average value of selected records COUNT: The number of records in the table SELECT ortakno, SUM(borc) as tborc, SUM(alacak) as talacak, sum(borc- alacak) as fark FROM tkart GROUP BY ortakno

15 He/she can use SQL instructions to create and manage database tables 15 SELECT MAX(borc) as maxborc, MAX(alacak) as maxalacak FROM tkart SELECT MIN(borc) as maxborc, MIN(alacak) as maxalacak FROM tkart

16 He/she can use SQL instructions to create and manage database tables 16 SELECT AVG(borc) as ortborc, AVG(alacak) as ortalacak FROM tkart SELECT COUNT(*) as KayıtSayısı FROM tkart

17 He/she can use SQL instructions to create and manage database tables 17 SELECT Zkimlik1.ortakno, zkimlik1.ad, zkimlik1.Soyad, zkimlik3.DTarih FROM Zkimlik1, zkimlik3 WHERE zkimlik1.ortakno=zkimlik3.ortakno

18 He/she can use SQL instructions to create and manage database tables 18 INSERT INTO Zkimlik1( ortakno, ad, soyad, BabaAd, DogYer, meslekgrubu ) VALUES ('2000', 'MEHMET', 'CAN', 'HASAN', 'SAKARYA', 2); UPDATE zkimlik1 SET ad = 'Ayşe', soyad = 'öz', BabaAd = 'mehmet', dogYer = 'Bolu', meslekgrubu = 3 WHERE ortakno='2000'; DELETE * FROM zkimlik1 WHERE ad='Ayşe';

19 19


Download ppt "Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  Basic SQL syntax  Data retrieve  Data query  Data conditions  Arithmetic operations on data  Data transactions."

Similar presentations


Ads by Google