SlideShare une entreprise Scribd logo
1  sur  32
SQL Server -  Design and Implementation
[object Object],[object Object],[object Object],An Overview of SQL
[object Object],[object Object],[object Object],[object Object],SQL is used for:
[object Object],[object Object],[object Object],SQL Requirements
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],SQL is a Relational Database A Fully Relational Database Management System must:
[object Object],[object Object],[object Object],Design
Basic structure of an SQL query
Table Design Rows describe the Occurrence of an Entity Columns describe one characteristic of the entity Tables are the basic structure where data is stored in the database. Name Address Jane Doe 123 Main Street John Smith 456 Second Street Mary Poe 789 Third Ave
SQL Constraints ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Not Null ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Default For example, if we create a table as below: CREATE TABLE Student  (Student_ID integer Unique,  Last_Name varchar (30),  First_Name varchar (30),  Score DEFAULT 80); and execute the following SQL statement, INSERT INTO Student (Student_ID, Last_Name, First_Name) values ('10','Johnson','Rick'); The table will look like the following: Even though we didn't specify a value for the "Score" column in the INSERT INTO statement, it does get assigned the default value of 80 since we had already set 80 as the default value for  this column. Student_ID Last_Name First_Name Score 10 Johnson Rick 80
Unique For example, in the following CREATE TABLE statement, CREATE TABLE Customer (SID integer Unique, Last_Name varchar (30),  First_Name varchar(30)); column "SID" has a unique constraint, and hence cannot include duplicate values.  Such constraint does not hold for columns "Last_Name" and "First_Name".  So, if the table already contains the following rows: Executing the following SQL statement, INSERT INTO Customer values ('3','Lee','Grace'); will result in an error because '3' already exists in the SID column, thus trying to insert  another row with that value violates the UNIQUE constraint. SID Last_Name First_Name 1 Johnson Stella 2 James Gina 3 Aaron Ralph
Check ,[object Object],[object Object],[object Object],[object Object],[object Object]
Primary Key A primary key is used to uniquely identify each row in a table. A primary key can consist of one or more fields on a table. When multiple fields are used as a primary key, they are called a composite key. CREATE TABLE Customer  (SID integer PRIMARY KEY,  Last_Name varchar(30),  First_Name varchar(30));
Foreign Key A foreign key is a field (or fields) that points to the primary key of another table. The purpose of the foreign key is, only values that are supposed to appear in the database are permitted. CREATE TABLE ORDERS  (Order_ID integer primary key, Order_Date datetime,  Customer_SID integer references CUSTOMER(SID),  Amount double); In the above example, the Customer_SID column in the ORDERS table is a foreign key pointing to the SID column in the CUSTOMER table.
[object Object],Data Retrieval (Queries) SELECT SELECT * FROM publishers ,[object Object],pub_id pub_name address state 0736 New Age Books 1 1 st  Street MA 0987 Binnet & Hardley 2 2 nd  Street DC 1120 Algodata Infosys 3 3 rd  Street CA
[object Object],Data Retrieval (Queries) ,[object Object],SELECT * from publishers where state = ‘CA’ pub_id pub_name address state 0736 New Age Books 1 1 st  Street MA 0987 Binnet & Hardley 2 2 nd  Street DC 1120 Algodata Infosys 3 3 rd  Street CA
[object Object],Data Input INSERT  ,[object Object],INSERT INTO publishers VALUES (‘0010’, ‘pragmatics’, ‘4 4 th  Ln’, ‘chicago’, ‘il’) Keyword Variable pub_id pub_name address state 0736 New Age Books 1 1 st  Street MA 0987 Binnet & Hardley 2 2 nd  Street DC 1120 Algodata Infosys 3 3 rd  Street CA pub_id pub_name address state 0010 Pragmatics 4 4 th  Ln IL 0736 New Age Books 1 1 st  Street MA 0987 Binnet & Hardley 2 2 nd  Street DC 1120 Algodata Infosys 3 3 rd  Street CA
[object Object],[object Object],Types of Tables There are two types of tables which make up a relational database in SQL pub_id pub_name address state 0010 Pragmatics 4 4 th  Ln IL 0736 New Age Books 1 1 st  Street MA 0987 Binnet & Hardley 2 2 nd  Street DC 1120 Algodata Infosys 3 3 rd  Street CA
Using SQL SQL statements can be embedded into a program (cgi or perl script, Visual Basic, C#, MS Access) OR SQL statements can be entered directly at the command prompt of the SQL software being used (such as mySQL)
Using SQL To begin, you must first CREATE a database using the following SQL statement: CREATE DATABASE database_name Depending on the version of SQL being used the following statement is needed to begin using the database: USE database_name
[object Object],Using SQL CREATE TABLE authors (auth_id int(9) not null, auth_name char(40) not null) auth_id auth_name (9 digit int) (40 char string)
[object Object],Using SQL ,[object Object],SELECT * FROM authors INSERT INTO authors values(‘000000001’, ‘John Smith’) 000000001 John Smith auth_id auth_name
Using SQL SELECT auth_name, auth_city FROM publishers If you only want to display the author’s name and city from the following table: auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI auth_name auth_city Jane Doe Dearborn John Smith Taylor
Using SQL DELETE from authors WHERE auth_name=‘John Smith’ To delete data from a table, use the DELETE statement: auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI
Using SQL UPDATE authors SET auth_name=‘hello’ To Update information in a database use the UPDATE keyword Hello Hello Sets all auth_name fields to hello auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI
Using SQL ALTER TABLE authors ADD birth_date datetime null To change a table in a database use ALTER TABLE.  ADD adds a characteristic. ADD puts a new column in the table called birth_date Type Initializer auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI birth_date . .
Using SQL ALTER TABLE authors DROP birth_date To delete a column or row, use the keyword DROP DROP removed the birth_date characteristic from the table auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI auth_state . .
Using SQL DROP DATABASE authors The DROP statement is also used to delete an entire database. DROP removed the database and returned the memory to system auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI
Normalization The process of removing redundant data by creating relations between tables is known as Normalization. Normalization process uses formal methods to design the database in interrelated tables.
Design DB
[object Object],[object Object],[object Object],Conclusion

Contenu connexe

Tendances (20)

Ms sql server ii
Ms sql server  iiMs sql server  ii
Ms sql server ii
 
Query
QueryQuery
Query
 
Chapter 07 ddl_sql
Chapter 07 ddl_sqlChapter 07 ddl_sql
Chapter 07 ddl_sql
 
MY SQL
MY SQLMY SQL
MY SQL
 
Database testing
Database testingDatabase testing
Database testing
 
Sq lite module7
Sq lite module7Sq lite module7
Sq lite module7
 
Sql
SqlSql
Sql
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
 
SQL
SQLSQL
SQL
 
Ankit
AnkitAnkit
Ankit
 
SImple SQL
SImple SQLSImple SQL
SImple SQL
 
SQL report
SQL reportSQL report
SQL report
 
Introduction to sq lite
Introduction to sq liteIntroduction to sq lite
Introduction to sq lite
 
Sql slid
Sql slidSql slid
Sql slid
 
Avinash database
Avinash databaseAvinash database
Avinash database
 
Intro to tsql unit 7
Intro to tsql   unit 7Intro to tsql   unit 7
Intro to tsql unit 7
 
Select To Order By
Select  To  Order BySelect  To  Order By
Select To Order By
 
Assignment#02
Assignment#02Assignment#02
Assignment#02
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 

En vedette

Irregular verbs, ingles iii
Irregular verbs, ingles iiiIrregular verbs, ingles iii
Irregular verbs, ingles iiiHome
 
Giana's Full Draft
Giana's Full DraftGiana's Full Draft
Giana's Full DraftGianaAnselmo
 
Purchase decision process
Purchase decision processPurchase decision process
Purchase decision processrkuchta
 
Gwtip 2011 slide show
Gwtip 2011 slide showGwtip 2011 slide show
Gwtip 2011 slide showgwvirginia
 
Budowa RESTowego api w oparciu o HATEOAS
Budowa RESTowego api w oparciu o HATEOASBudowa RESTowego api w oparciu o HATEOAS
Budowa RESTowego api w oparciu o HATEOASMateusz Stępniak
 
Inotrópicos 2016-2
Inotrópicos 2016-2Inotrópicos 2016-2
Inotrópicos 2016-2David Perez
 
bahagian b penulisan
bahagian b   penulisanbahagian b   penulisan
bahagian b penulisanMohd Amri
 
Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013
Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013
Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013Kate Reifers
 
Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013
Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013
Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013Mateusz Stępniak
 

En vedette (11)

Irregular verbs, ingles iii
Irregular verbs, ingles iiiIrregular verbs, ingles iii
Irregular verbs, ingles iii
 
Giana's Full Draft
Giana's Full DraftGiana's Full Draft
Giana's Full Draft
 
Purchase decision process
Purchase decision processPurchase decision process
Purchase decision process
 
Gwtip 2011 slide show
Gwtip 2011 slide showGwtip 2011 slide show
Gwtip 2011 slide show
 
Budowa RESTowego api w oparciu o HATEOAS
Budowa RESTowego api w oparciu o HATEOASBudowa RESTowego api w oparciu o HATEOAS
Budowa RESTowego api w oparciu o HATEOAS
 
Inotrópicos 2016-2
Inotrópicos 2016-2Inotrópicos 2016-2
Inotrópicos 2016-2
 
bahagian b penulisan
bahagian b   penulisanbahagian b   penulisan
bahagian b penulisan
 
Modulo metodos probabilisticos-2013 (2)
Modulo metodos probabilisticos-2013 (2)Modulo metodos probabilisticos-2013 (2)
Modulo metodos probabilisticos-2013 (2)
 
Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013
Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013
Aerospace & Defense Manufacturing in Tijuana, Mexico - White Paper 2013
 
Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013
Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013
Budowa poprawnego i intuicyjnego api REST HATEOAS devfest@2013
 
afsfdsdf
afsfdsdfafsfdsdf
afsfdsdf
 

Similaire à Sql

Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commandsBelle Wx
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...SakkaravarthiS1
 
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDSORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDSNewyorksys.com
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Languagepandey3045_bit
 
SQL Beginners anishurrehman.cloud.pdf
SQL Beginners anishurrehman.cloud.pdfSQL Beginners anishurrehman.cloud.pdf
SQL Beginners anishurrehman.cloud.pdfAnishurRehman1
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standardsAlessandro Baratella
 
Entigrity constraint
Entigrity constraintEntigrity constraint
Entigrity constraintsuman kumar
 

Similaire à Sql (20)

Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Sql 2006
Sql 2006Sql 2006
Sql 2006
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
chapter 8 SQL.ppt
chapter 8 SQL.pptchapter 8 SQL.ppt
chapter 8 SQL.ppt
 
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
 
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDSORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Language
 
Module 3
Module 3Module 3
Module 3
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql
SqlSql
Sql
 
SQL Beginners anishurrehman.cloud.pdf
SQL Beginners anishurrehman.cloud.pdfSQL Beginners anishurrehman.cloud.pdf
SQL Beginners anishurrehman.cloud.pdf
 
SQL
SQLSQL
SQL
 
SQL
SQLSQL
SQL
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
Entigrity constraint
Entigrity constraintEntigrity constraint
Entigrity constraint
 
SQL.ppt
SQL.pptSQL.ppt
SQL.ppt
 
Chap 7
Chap 7Chap 7
Chap 7
 
Lab
LabLab
Lab
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
 

Dernier

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Dernier (20)

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

Sql

  • 1. SQL Server - Design and Implementation
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Basic structure of an SQL query
  • 8. Table Design Rows describe the Occurrence of an Entity Columns describe one characteristic of the entity Tables are the basic structure where data is stored in the database. Name Address Jane Doe 123 Main Street John Smith 456 Second Street Mary Poe 789 Third Ave
  • 9.
  • 10.
  • 11. Default For example, if we create a table as below: CREATE TABLE Student  (Student_ID integer Unique,  Last_Name varchar (30),  First_Name varchar (30),  Score DEFAULT 80); and execute the following SQL statement, INSERT INTO Student (Student_ID, Last_Name, First_Name) values ('10','Johnson','Rick'); The table will look like the following: Even though we didn't specify a value for the "Score" column in the INSERT INTO statement, it does get assigned the default value of 80 since we had already set 80 as the default value for this column. Student_ID Last_Name First_Name Score 10 Johnson Rick 80
  • 12. Unique For example, in the following CREATE TABLE statement, CREATE TABLE Customer (SID integer Unique, Last_Name varchar (30),  First_Name varchar(30)); column "SID" has a unique constraint, and hence cannot include duplicate values. Such constraint does not hold for columns "Last_Name" and "First_Name". So, if the table already contains the following rows: Executing the following SQL statement, INSERT INTO Customer values ('3','Lee','Grace'); will result in an error because '3' already exists in the SID column, thus trying to insert another row with that value violates the UNIQUE constraint. SID Last_Name First_Name 1 Johnson Stella 2 James Gina 3 Aaron Ralph
  • 13.
  • 14. Primary Key A primary key is used to uniquely identify each row in a table. A primary key can consist of one or more fields on a table. When multiple fields are used as a primary key, they are called a composite key. CREATE TABLE Customer  (SID integer PRIMARY KEY,  Last_Name varchar(30),  First_Name varchar(30));
  • 15. Foreign Key A foreign key is a field (or fields) that points to the primary key of another table. The purpose of the foreign key is, only values that are supposed to appear in the database are permitted. CREATE TABLE ORDERS  (Order_ID integer primary key, Order_Date datetime,  Customer_SID integer references CUSTOMER(SID),  Amount double); In the above example, the Customer_SID column in the ORDERS table is a foreign key pointing to the SID column in the CUSTOMER table.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. Using SQL SQL statements can be embedded into a program (cgi or perl script, Visual Basic, C#, MS Access) OR SQL statements can be entered directly at the command prompt of the SQL software being used (such as mySQL)
  • 21. Using SQL To begin, you must first CREATE a database using the following SQL statement: CREATE DATABASE database_name Depending on the version of SQL being used the following statement is needed to begin using the database: USE database_name
  • 22.
  • 23.
  • 24. Using SQL SELECT auth_name, auth_city FROM publishers If you only want to display the author’s name and city from the following table: auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI auth_name auth_city Jane Doe Dearborn John Smith Taylor
  • 25. Using SQL DELETE from authors WHERE auth_name=‘John Smith’ To delete data from a table, use the DELETE statement: auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI
  • 26. Using SQL UPDATE authors SET auth_name=‘hello’ To Update information in a database use the UPDATE keyword Hello Hello Sets all auth_name fields to hello auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI
  • 27. Using SQL ALTER TABLE authors ADD birth_date datetime null To change a table in a database use ALTER TABLE. ADD adds a characteristic. ADD puts a new column in the table called birth_date Type Initializer auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI birth_date . .
  • 28. Using SQL ALTER TABLE authors DROP birth_date To delete a column or row, use the keyword DROP DROP removed the birth_date characteristic from the table auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI auth_state . .
  • 29. Using SQL DROP DATABASE authors The DROP statement is also used to delete an entire database. DROP removed the database and returned the memory to system auth_id auth_name auth_city auth_state 123456789 Jane Doe Dearborn MI 000000001 John Smith Taylor MI
  • 30. Normalization The process of removing redundant data by creating relations between tables is known as Normalization. Normalization process uses formal methods to design the database in interrelated tables.
  • 32.

Notes de l'éditeur

  1. Frequently, presenters must deliver material of a technical nature to an audience unfamiliar with the topic or vocabulary. The material may be complex or heavy with detail. To present technical material effectively, use the following guidelines from Dale Carnegie Training®.   Consider the amount of time available and prepare to organize your material. Narrow your topic. Divide your presentation into clear segments. Follow a logical progression. Maintain your focus throughout. Close the presentation with a summary, repetition of the key steps, or a logical conclusion.   Keep your audience in mind at all times. For example, be sure data is clear and information is relevant. Keep the level of detail and vocabulary appropriate for the audience. Use visuals to support key points or steps. Keep alert to the needs of your listeners, and you will have a more receptive audience.
  2. In your opening, establish the relevancy of the topic to the audience. Give a brief preview of the presentation and establish value for the listeners. Take into account your audience’s interest and expertise in the topic when choosing your vocabulary, examples, and illustrations. Focus on the importance of the topic to your audience, and you will have more attentive listeners.
  3. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  4. In your opening, establish the relevancy of the topic to the audience. Give a brief preview of the presentation and establish value for the listeners. Take into account your audience’s interest and expertise in the topic when choosing your vocabulary, examples, and illustrations. Focus on the importance of the topic to your audience, and you will have more attentive listeners.
  5. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  6. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  7. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  8. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  9. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  10. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  11. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  12. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  13. If you have several points, steps, or key ideas use multiple slides. Determine if your audience is to understand a new idea, learn a process, or receive greater depth to a familiar concept. Back up each point with adequate explanation. As appropriate, supplement your presentation with technical support data in hard copy or on disc, e-mail, or the Internet. Develop each point adequately to communicate with your audience.
  14. Determine the best close for your audience and your presentation. Close with a summary; offer options; recommend a strategy; suggest a plan; set a goal. Keep your focus throughout your presentation, and you will more likely achieve your purpose.