SlideShare a Scribd company logo
What is SQL?
Structured Query Language
Communicate with databases
Used to created and edit databases.
Also used to create queries, forms, and reports
Table Basics
A Table is an object
Database data is stored in Tables
Each table has a unique name
Columns have various attributes, such as column
name and data type
Rows contain records or data for the columns
Weather Sample Table
City State High Low
Phoenix Arizona 105 90
Tuscon Arizona 101 92
Flagstaff Arizona 88 69
San Diego California 77 60
Albuquerque New Mexico 80 60
Selecting Data
The Select statement is used to get data which
matches the specified criteria. Here is the basic
syntax:
ex)
select “columnname1”, “columnname2”
from “tablename”
where “condition”
Conditions Used In Where Clause
= equals
> greater than
< less than
>= greater than or equal to
<= less than or equal to
<> not equal to
Like
Used to make complex searching easy. If you are trying
to find all people’s names which begin with E for
example:
ex) select firstname from employee
where firstname LIKE 'E%';
Creating Tables
The statement to use is create table
Here is the syntax:
create table “tablename”
(“columnname”, “datatype”,
“columnname2”, “datatype”,
“columnname3”, “datatype”);
Creating content for Tables
Here is a real example:
create table employee
(first varchar(15),
last varchar(20),
age number(3),
address varchar(30),
city varchar(20),
state varchar(20));
Creating Tables – Variables
If you took algebra then y=2x might be familiar. y
and x are unknown information, which is a variable.
Now a string is a bunch of letters and numbers
A number is a bunch of numbers
A data type determines what a variable can hold, i.e.
strings or numbers
Creating Tables – Data Types cont’d
number(size) - a number value that can not exceed,
size columns, for example if you have size = 10, then
you can only have 10 different digit places, like
1,000,000,000
date - date value
number(size,d) - This works the same as the regular
number except d represents # of columns after the
decimal.
Creating Tables - Constraints
A constraint is a rule.
Some examples constraints are:
• unique - no two entries will be the same
• not null - no entry can be blank
• **primary key - unique identification of each row**
• primary keys will be very important to you as your
knowledge of databases progresses
Inserting Information into Tables
To insert into tables you need only use the
keyword insert. Here is the syntax:
insert into "tablename"
(“first_column”, ..., “last_column”)
values (“first_value”, ...,“last value”);
Inserting Information into Tables
Here is a practical example:
insert into employees
(first, last, age, address, city, state)
values ( 'Luke', 'Duke', 45, '2130 Boars Nest',
'Hazard Co', 'Georgia');
Inserting Information into Tables Steps
**All strings should be enclosed by single
quotes: 'string'**
1. Use the keyword "insert into" followed by the
tablename
2. Then on the next line, in parenthesis, list all the
columns you are inserting values for.
3. Then on the line after, type values, then in
parenthesis, put the values in the same order as
the columns they belong to
Updating Records
To update records use the "update" statement.
Here is the syntax:
update “tablename”
set “columnname” = “newvalue”,
“nextcolumn” = “newvalue2”, ...
where “columnname” OPERATOR
“value” and|or “columnname2 OPERATOR “value”
Updating Records cont’d
Here are some practical examples:
ex)
update phone_book
set area_code = 623
where prefix = 979;
This changes the area code all numbers
beginning with 979 to 623
Updating Records cont’d
update phone_book
set last_name = 'Smith', prefix=555, sufix=9292
where last_name = 'Jones';
This changes everyone whose last name is Jones
to Smith and their number to 555-9292
Deleting Records
Here is the syntax:
delete from “tablename”
where “columnname” OPERATOR “value”
and|or “columnname2” OPERATOR “value”
Deleting Records Examples
ex) delete from employees;
deletes all records from that table
ex) delete from employee
where lastname='May';
deletes all records for people whose last name is
May
ex) delete from employee
where firstname='Mike' or firstname='Eric';
deletes all records for anyone whose first name is Mike
or Eric
Deleting Tables
Use the drop command
drop table "tablename";
drop table employees;
Bye Bye Table, Hello Corporate Espoinage =)
Oracle training in Tambaram
http://www.trainingintambaram.in

More Related Content

What's hot

Import Data using R
Import Data using R Import Data using R
Import Data using R
Rupak Roy
 
Sql Basics | Edureka
Sql Basics | EdurekaSql Basics | Edureka
Sql Basics | Edureka
Edureka!
 
Stata Cheat Sheets (all)
Stata Cheat Sheets (all)Stata Cheat Sheets (all)
Stata Cheat Sheets (all)
Laura Hughes
 
Null values, insert, delete and update in database
Null values, insert, delete and update in databaseNull values, insert, delete and update in database
Null values, insert, delete and update in database
Hemant Suthar
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
BG Java EE Course
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
TanishaKochak
 
Sqlbysandeep
SqlbysandeepSqlbysandeep
Sqlbysandeep
sandeepkhandare1183
 
Lab1 select statement
Lab1 select statementLab1 select statement
Lab1 select statement
Balqees Al.Mubarak
 
SQL
SQLSQL
SQL
SQLSQL
Using ddl statements to create and manage tables
Using ddl statements to create and manage tablesUsing ddl statements to create and manage tables
Using ddl statements to create and manage tables
Syed Zaid Irshad
 
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
Dev Chauhan
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - Basics
Purvik Rana
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
Al-Mamun Sarkar
 
Array
ArrayArray
Array
ArrayArray
Msql query
Msql queryMsql query
Msql query
harman kaur
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 
Sql Document in Testing
Sql Document in TestingSql Document in Testing
Sql Document in Testing
Saurabh Bhardwaj
 

What's hot (19)

Import Data using R
Import Data using R Import Data using R
Import Data using R
 
Sql Basics | Edureka
Sql Basics | EdurekaSql Basics | Edureka
Sql Basics | Edureka
 
Stata Cheat Sheets (all)
Stata Cheat Sheets (all)Stata Cheat Sheets (all)
Stata Cheat Sheets (all)
 
Null values, insert, delete and update in database
Null values, insert, delete and update in databaseNull values, insert, delete and update in database
Null values, insert, delete and update in database
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
 
Sqlbysandeep
SqlbysandeepSqlbysandeep
Sqlbysandeep
 
Lab1 select statement
Lab1 select statementLab1 select statement
Lab1 select statement
 
SQL
SQLSQL
SQL
 
SQL
SQLSQL
SQL
 
Using ddl statements to create and manage tables
Using ddl statements to create and manage tablesUsing ddl statements to create and manage tables
Using ddl statements to create and manage tables
 
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - Basics
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
 
Array
ArrayArray
Array
 
Array
ArrayArray
Array
 
Msql query
Msql queryMsql query
Msql query
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Sql Document in Testing
Sql Document in TestingSql Document in Testing
Sql Document in Testing
 

Similar to Sql tables

SImple SQL
SImple SQLSImple SQL
SImple SQL
John Cutajar
 
SQL report
SQL reportSQL report
SQL report
Ahmad Zahid
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
Iblesoft
 
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsgADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
zmulani8
 
Class XII-UNIT III - SQL and MySQL Notes_0.pdf
Class XII-UNIT III - SQL and MySQL Notes_0.pdfClass XII-UNIT III - SQL and MySQL Notes_0.pdf
Class XII-UNIT III - SQL and MySQL Notes_0.pdf
rohithlingineni1
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
PriyaPandey767008
 
unit 1 ppt.pptx
unit 1 ppt.pptxunit 1 ppt.pptx
unit 1 ppt.pptx
VillainMass
 
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
prashant0000
 
SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)
Edu4Sure
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
Sherif Gad
 
ADV PPT 2 LAB.pptx
ADV PPT 2 LAB.pptxADV PPT 2 LAB.pptx
ADV PPT 2 LAB.pptx
ArjayBalberan1
 
Sql 2006
Sql 2006Sql 2006
Sql 2006
Cathie101
 
Module 3
Module 3Module 3
Module 3
cs19club
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
Alessandro Baratella
 
Sql
SqlSql
Intro to SQL by Google's Software Engineer
Intro to SQL by Google's Software EngineerIntro to SQL by Google's Software Engineer
Intro to SQL by Google's Software Engineer
Product School
 
012. SQL.pdf
012. SQL.pdf012. SQL.pdf
012. SQL.pdf
recosi2217
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
RaviRajput416403
 
Dbms sql-final
Dbms  sql-finalDbms  sql-final
Dbms
DbmsDbms

Similar to Sql tables (20)

SImple SQL
SImple SQLSImple SQL
SImple SQL
 
SQL report
SQL reportSQL report
SQL report
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
 
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsgADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
ADBMS unit 1.pdfsdgdsgdsgdsgdsgdsgdsgdsg
 
Class XII-UNIT III - SQL and MySQL Notes_0.pdf
Class XII-UNIT III - SQL and MySQL Notes_0.pdfClass XII-UNIT III - SQL and MySQL Notes_0.pdf
Class XII-UNIT III - SQL and MySQL Notes_0.pdf
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
unit 1 ppt.pptx
unit 1 ppt.pptxunit 1 ppt.pptx
unit 1 ppt.pptx
 
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
 
SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
 
ADV PPT 2 LAB.pptx
ADV PPT 2 LAB.pptxADV PPT 2 LAB.pptx
ADV PPT 2 LAB.pptx
 
Sql 2006
Sql 2006Sql 2006
Sql 2006
 
Module 3
Module 3Module 3
Module 3
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
Sql
SqlSql
Sql
 
Intro to SQL by Google's Software Engineer
Intro to SQL by Google's Software EngineerIntro to SQL by Google's Software Engineer
Intro to SQL by Google's Software Engineer
 
012. SQL.pdf
012. SQL.pdf012. SQL.pdf
012. SQL.pdf
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
 
Dbms sql-final
Dbms  sql-finalDbms  sql-final
Dbms sql-final
 
Dbms
DbmsDbms
Dbms
 

Recently uploaded

Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Vivekanand Anglo Vedic Academy
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 

Sql tables

  • 1.
  • 2. What is SQL? Structured Query Language Communicate with databases Used to created and edit databases. Also used to create queries, forms, and reports
  • 3. Table Basics A Table is an object Database data is stored in Tables Each table has a unique name Columns have various attributes, such as column name and data type Rows contain records or data for the columns
  • 4. Weather Sample Table City State High Low Phoenix Arizona 105 90 Tuscon Arizona 101 92 Flagstaff Arizona 88 69 San Diego California 77 60 Albuquerque New Mexico 80 60
  • 5. Selecting Data The Select statement is used to get data which matches the specified criteria. Here is the basic syntax: ex) select “columnname1”, “columnname2” from “tablename” where “condition”
  • 6. Conditions Used In Where Clause = equals > greater than < less than >= greater than or equal to <= less than or equal to <> not equal to
  • 7. Like Used to make complex searching easy. If you are trying to find all people’s names which begin with E for example: ex) select firstname from employee where firstname LIKE 'E%';
  • 8. Creating Tables The statement to use is create table Here is the syntax: create table “tablename” (“columnname”, “datatype”, “columnname2”, “datatype”, “columnname3”, “datatype”);
  • 9. Creating content for Tables Here is a real example: create table employee (first varchar(15), last varchar(20), age number(3), address varchar(30), city varchar(20), state varchar(20));
  • 10. Creating Tables – Variables If you took algebra then y=2x might be familiar. y and x are unknown information, which is a variable. Now a string is a bunch of letters and numbers A number is a bunch of numbers A data type determines what a variable can hold, i.e. strings or numbers
  • 11. Creating Tables – Data Types cont’d number(size) - a number value that can not exceed, size columns, for example if you have size = 10, then you can only have 10 different digit places, like 1,000,000,000 date - date value number(size,d) - This works the same as the regular number except d represents # of columns after the decimal.
  • 12. Creating Tables - Constraints A constraint is a rule. Some examples constraints are: • unique - no two entries will be the same • not null - no entry can be blank • **primary key - unique identification of each row** • primary keys will be very important to you as your knowledge of databases progresses
  • 13. Inserting Information into Tables To insert into tables you need only use the keyword insert. Here is the syntax: insert into "tablename" (“first_column”, ..., “last_column”) values (“first_value”, ...,“last value”);
  • 14. Inserting Information into Tables Here is a practical example: insert into employees (first, last, age, address, city, state) values ( 'Luke', 'Duke', 45, '2130 Boars Nest', 'Hazard Co', 'Georgia');
  • 15. Inserting Information into Tables Steps **All strings should be enclosed by single quotes: 'string'** 1. Use the keyword "insert into" followed by the tablename 2. Then on the next line, in parenthesis, list all the columns you are inserting values for. 3. Then on the line after, type values, then in parenthesis, put the values in the same order as the columns they belong to
  • 16. Updating Records To update records use the "update" statement. Here is the syntax: update “tablename” set “columnname” = “newvalue”, “nextcolumn” = “newvalue2”, ... where “columnname” OPERATOR “value” and|or “columnname2 OPERATOR “value”
  • 17. Updating Records cont’d Here are some practical examples: ex) update phone_book set area_code = 623 where prefix = 979; This changes the area code all numbers beginning with 979 to 623
  • 18. Updating Records cont’d update phone_book set last_name = 'Smith', prefix=555, sufix=9292 where last_name = 'Jones'; This changes everyone whose last name is Jones to Smith and their number to 555-9292
  • 19. Deleting Records Here is the syntax: delete from “tablename” where “columnname” OPERATOR “value” and|or “columnname2” OPERATOR “value”
  • 20. Deleting Records Examples ex) delete from employees; deletes all records from that table ex) delete from employee where lastname='May'; deletes all records for people whose last name is May ex) delete from employee where firstname='Mike' or firstname='Eric'; deletes all records for anyone whose first name is Mike or Eric
  • 21. Deleting Tables Use the drop command drop table "tablename"; drop table employees; Bye Bye Table, Hello Corporate Espoinage =)
  • 22. Oracle training in Tambaram http://www.trainingintambaram.in