Enviar pesquisa
Carregar
Sql xp 06
•
Transferir como PPS, PDF
•
0 gostou
•
534 visualizações
Niit Care
Seguir
Tecnologia
Negócios
Vista de apresentação de diapositivos
Denunciar
Compartilhar
Vista de apresentação de diapositivos
Denunciar
Compartilhar
1 de 50
Baixar agora
Recomendados
Sql xp 04
Sql xp 04
Niit Care
Sql xp 07
Sql xp 07
Niit Care
Sql xp 03
Sql xp 03
Niit Care
Sql xp 01
Sql xp 01
Niit Care
Sql xp 02
Sql xp 02
Niit Care
Sql xp 05
Sql xp 05
Niit Care
Oracle SQL Advanced
Oracle SQL Advanced
Dhananjay Goel
Sql ch 4
Sql ch 4
Mukesh Tekwani
Recomendados
Sql xp 04
Sql xp 04
Niit Care
Sql xp 07
Sql xp 07
Niit Care
Sql xp 03
Sql xp 03
Niit Care
Sql xp 01
Sql xp 01
Niit Care
Sql xp 02
Sql xp 02
Niit Care
Sql xp 05
Sql xp 05
Niit Care
Oracle SQL Advanced
Oracle SQL Advanced
Dhananjay Goel
Sql ch 4
Sql ch 4
Mukesh Tekwani
Teradata imp
Teradata imp
Hameed Lebbai
Application sql issues_and_tuning
Application sql issues_and_tuning
Anil Pandey
Tufte Sample Bi Portfolio
Tufte Sample Bi Portfolio
dtufte
ch4
ch4
KITE www.kitecolleges.com
Sq lite module8
Sq lite module8
Highervista
Sql wksht-2
Sql wksht-2
Mukesh Tekwani
Assg2 b 19121033-converted
Assg2 b 19121033-converted
SUSHANTPHALKE2
Partitioning tables and indexing them
Partitioning tables and indexing them
Hemant K Chitale
Partitioning on Oracle 12c - What changed on the most important Oracle feature
Partitioning on Oracle 12c - What changed on the most important Oracle feature
Luis Marques
Sql views
Sql views
arshid045
Sql basics
Sql basics
Genesis Omo
Partitioning Tables and Indexing Them --- Article
Partitioning Tables and Indexing Them --- Article
Hemant K Chitale
SQL(database)
SQL(database)
welcometofacebook
BIS06 Physical Database Models
BIS06 Physical Database Models
Prithwis Mukerjee
Oracle SQL Part 2
Oracle SQL Part 2
Gurpreet singh
Oracle SQL Part 3
Oracle SQL Part 3
Gurpreet singh
Sql ch 5
Sql ch 5
Mukesh Tekwani
Sql basic best-course-in-mumbai
Sql basic best-course-in-mumbai
vibrantuser
SQL for ETL Testing
SQL for ETL Testing
Garuda Trainings
MYSQL join
MYSQL join
Ahmed Farag
Sql xp 08
Sql xp 08
Niit Care
Structured Query Language for Data Management 2 Sructu.docx
Structured Query Language for Data Management 2 Sructu.docx
johniemcm5zt
Mais conteúdo relacionado
Mais procurados
Teradata imp
Teradata imp
Hameed Lebbai
Application sql issues_and_tuning
Application sql issues_and_tuning
Anil Pandey
Tufte Sample Bi Portfolio
Tufte Sample Bi Portfolio
dtufte
ch4
ch4
KITE www.kitecolleges.com
Sq lite module8
Sq lite module8
Highervista
Sql wksht-2
Sql wksht-2
Mukesh Tekwani
Assg2 b 19121033-converted
Assg2 b 19121033-converted
SUSHANTPHALKE2
Partitioning tables and indexing them
Partitioning tables and indexing them
Hemant K Chitale
Partitioning on Oracle 12c - What changed on the most important Oracle feature
Partitioning on Oracle 12c - What changed on the most important Oracle feature
Luis Marques
Sql views
Sql views
arshid045
Sql basics
Sql basics
Genesis Omo
Partitioning Tables and Indexing Them --- Article
Partitioning Tables and Indexing Them --- Article
Hemant K Chitale
SQL(database)
SQL(database)
welcometofacebook
BIS06 Physical Database Models
BIS06 Physical Database Models
Prithwis Mukerjee
Oracle SQL Part 2
Oracle SQL Part 2
Gurpreet singh
Oracle SQL Part 3
Oracle SQL Part 3
Gurpreet singh
Sql ch 5
Sql ch 5
Mukesh Tekwani
Sql basic best-course-in-mumbai
Sql basic best-course-in-mumbai
vibrantuser
SQL for ETL Testing
SQL for ETL Testing
Garuda Trainings
MYSQL join
MYSQL join
Ahmed Farag
Mais procurados
(20)
Teradata imp
Teradata imp
Application sql issues_and_tuning
Application sql issues_and_tuning
Tufte Sample Bi Portfolio
Tufte Sample Bi Portfolio
ch4
ch4
Sq lite module8
Sq lite module8
Sql wksht-2
Sql wksht-2
Assg2 b 19121033-converted
Assg2 b 19121033-converted
Partitioning tables and indexing them
Partitioning tables and indexing them
Partitioning on Oracle 12c - What changed on the most important Oracle feature
Partitioning on Oracle 12c - What changed on the most important Oracle feature
Sql views
Sql views
Sql basics
Sql basics
Partitioning Tables and Indexing Them --- Article
Partitioning Tables and Indexing Them --- Article
SQL(database)
SQL(database)
BIS06 Physical Database Models
BIS06 Physical Database Models
Oracle SQL Part 2
Oracle SQL Part 2
Oracle SQL Part 3
Oracle SQL Part 3
Sql ch 5
Sql ch 5
Sql basic best-course-in-mumbai
Sql basic best-course-in-mumbai
SQL for ETL Testing
SQL for ETL Testing
MYSQL join
MYSQL join
Semelhante a Sql xp 06
Sql xp 08
Sql xp 08
Niit Care
Structured Query Language for Data Management 2 Sructu.docx
Structured Query Language for Data Management 2 Sructu.docx
johniemcm5zt
Sql server T-sql basics ppt-3
Sql server T-sql basics ppt-3
Vibrant Technologies & Computers
Getting Started with MySQL II
Getting Started with MySQL II
Sankhya_Analytics
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
christinemaritza
The Database Environment Chapter 7
The Database Environment Chapter 7
Jeanie Arnoco
chap 7.ppt(sql).ppt
chap 7.ppt(sql).ppt
arjun431527
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
Jürgen Ambrosi
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
Dave Stokes
TSQL in SQL Server 2012
TSQL in SQL Server 2012
Eduardo Castro
Lab guide10
Lab guide10
Mehmetcan Taş
Basics of Microsoft Business Intelligence and Data Integration Techniques
Basics of Microsoft Business Intelligence and Data Integration Techniques
Valmik Potbhare
Chap 7
Chap 7
Karan Patil
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
Vibrant Technologies & Computers
T6
T6
NidhiGupta8431
Intro to SQL for Beginners
Intro to SQL for Beginners
Product School
SQL
SQL
Harshad Umredkar
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 Presentation
Dave Stokes
Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015
Alex Zaballa
PNWPHP -- What are Databases so &#%-ing Difficult
PNWPHP -- What are Databases so &#%-ing Difficult
Dave Stokes
Semelhante a Sql xp 06
(20)
Sql xp 08
Sql xp 08
Structured Query Language for Data Management 2 Sructu.docx
Structured Query Language for Data Management 2 Sructu.docx
Sql server T-sql basics ppt-3
Sql server T-sql basics ppt-3
Getting Started with MySQL II
Getting Started with MySQL II
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
The Database Environment Chapter 7
The Database Environment Chapter 7
chap 7.ppt(sql).ppt
chap 7.ppt(sql).ppt
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
TSQL in SQL Server 2012
TSQL in SQL Server 2012
Lab guide10
Lab guide10
Basics of Microsoft Business Intelligence and Data Integration Techniques
Basics of Microsoft Business Intelligence and Data Integration Techniques
Chap 7
Chap 7
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
T6
T6
Intro to SQL for Beginners
Intro to SQL for Beginners
SQL
SQL
MySQL New Features -- Sunshine PHP 2020 Presentation
MySQL New Features -- Sunshine PHP 2020 Presentation
Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015
PNWPHP -- What are Databases so &#%-ing Difficult
PNWPHP -- What are Databases so &#%-ing Difficult
Mais de Niit Care
Ajs 1 b
Ajs 1 b
Niit Care
Ajs 4 b
Ajs 4 b
Niit Care
Ajs 4 a
Ajs 4 a
Niit Care
Ajs 4 c
Ajs 4 c
Niit Care
Ajs 3 b
Ajs 3 b
Niit Care
Ajs 3 a
Ajs 3 a
Niit Care
Ajs 3 c
Ajs 3 c
Niit Care
Ajs 2 b
Ajs 2 b
Niit Care
Ajs 2 a
Ajs 2 a
Niit Care
Ajs 2 c
Ajs 2 c
Niit Care
Ajs 1 a
Ajs 1 a
Niit Care
Ajs 1 c
Ajs 1 c
Niit Care
Dacj 4 2-c
Dacj 4 2-c
Niit Care
Dacj 4 2-b
Dacj 4 2-b
Niit Care
Dacj 4 2-a
Dacj 4 2-a
Niit Care
Dacj 4 1-c
Dacj 4 1-c
Niit Care
Dacj 4 1-b
Dacj 4 1-b
Niit Care
Dacj 4 1-a
Dacj 4 1-a
Niit Care
Dacj 1-2 b
Dacj 1-2 b
Niit Care
Dacj 1-3 c
Dacj 1-3 c
Niit Care
Mais de Niit Care
(20)
Ajs 1 b
Ajs 1 b
Ajs 4 b
Ajs 4 b
Ajs 4 a
Ajs 4 a
Ajs 4 c
Ajs 4 c
Ajs 3 b
Ajs 3 b
Ajs 3 a
Ajs 3 a
Ajs 3 c
Ajs 3 c
Ajs 2 b
Ajs 2 b
Ajs 2 a
Ajs 2 a
Ajs 2 c
Ajs 2 c
Ajs 1 a
Ajs 1 a
Ajs 1 c
Ajs 1 c
Dacj 4 2-c
Dacj 4 2-c
Dacj 4 2-b
Dacj 4 2-b
Dacj 4 2-a
Dacj 4 2-a
Dacj 4 1-c
Dacj 4 1-c
Dacj 4 1-b
Dacj 4 1-b
Dacj 4 1-a
Dacj 4 1-a
Dacj 1-2 b
Dacj 1-2 b
Dacj 1-3 c
Dacj 1-3 c
Último
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Sinan KOZAK
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
Mark Billinghurst
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
OnBoard
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
ThousandEyes
Key Features Of Token Development (1).pptx
Key Features Of Token Development (1).pptx
LBM Solutions
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
Softradix Technologies
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
HostedbyConfluent
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
carlostorres15106
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Katpro Technologies
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Último
(20)
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Key Features Of Token Development (1).pptx
Key Features Of Token Development (1).pptx
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Sql xp 06
1.
Manage Data in
Tables Objectives In this lesson, you will learn to: Create rules Create defaults Maintain data in a table by using INSERT statement UPDATE statement DELETE statement Truncate a table ©NIIT SQL/Lesson 6/Slide 1 of 50
2.
Manage Data in
Tables 6.D.1 Creating a Rule The zip code in the Newspaper table should be of the character type and should have the following pattern: [0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] An example of such a pattern is: 42482-4353 Without changing the table structure, how can you ensure that you can meet this requirement? ©NIIT SQL/Lesson 6/Slide 2 of 50
3.
Manage Data in
Tables Task List Identify how to implement the constraint without changing the table structure Draft the statement to create a rule Create the rule Bind the rule to the column Verify the constraint by inserting data in the table ©NIIT SQL/Lesson 6/Slide 3 of 50
4.
Manage Data in
Tables Identify how to implement the constraint without changing the table structure A rule provides a mechanism for enforcing domain integrity for columns or user-defined datatypes. The rule is applied to the column or the user-defined datatype before an INSERT or UPDATE statement is issued. Result: The constraint can be implemented by using rules. ©NIIT SQL/Lesson 6/Slide 4 of 50
5.
Manage Data in
Tables Draft the statement to create a rule The CREATE RULE Statement: Is used to create a rule Syntax CREATE RULE rule_name AS conditional_expression Action: The rule would be applied on the cNewspaperCode attribute The condition to be applied is: @ZipCode LIKE '[0-9][0-9][0-9][0-9][0-9]- [0-9][0-9][0-9][0-9]' The name of the rule would be rulZipCode ©NIIT SQL/Lesson 6/Slide 5 of 50
6.
Manage Data in
Tables Draft the statement to create a rule (Contd.) The rule can be created as follows: CREATE RULE rulZipCode AS @ZipCode LIKE '[0-9][0-9][0-9][0-9][0-9]- [0-9][0-9][0-9][0-9]' ©NIIT SQL/Lesson 6/Slide 6 of 50
7.
Manage Data in
Tables Create the rule Action: In the Query Analyzer window, type the query Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 7 of 50
8.
Manage Data in
Tables Bind the rule to the column Binding Rules A rule can be bound using the sp_bindrule system store procedure Syntax sp_bindrule rule_name, object_name [,FUTUREONLY] Unbinding Rules A rule can be unbound from a column or user-defined datatype using the sp_unbindrule system stored procedure Syntax sp_unbindrule object_name [, FUTUREONLY] ©NIIT SQL/Lesson 6/Slide 8 of 50
9.
Manage Data in
Tables Bind the rule to the column (Contd.) Action: In the Query Analyzer, type: sp_bindrule rulZipCode,'Newspaper.cZip' Press F5 to execute the code ©NIIT SQL/Lesson 6/Slide 9 of 50
10.
Manage Data in
Tables Verify the constraint by inserting data in the table Action Test case cZip to be Result inserted 1 3452345 The row would not be inserted, as the zip code is not in the valid format 2 34563-5678 The row would be inserted, as the zip code is in the valid format ©NIIT SQL/Lesson 6/Slide 10 of 50
11.
Manage Data in
Tables Just a Minute… Which system stored procedure is used to bind and unbind a rule? ©NIIT SQL/Lesson 6/Slide 11 of 50
12.
Manage Data in
Tables 6.D.2 Creating a Default The data entry operator complains that for most rows, he has to repeatedly enter the code 001 for the cCountryCode attribute of the Newspaper table. You need to simplify the data entry task without modifying the table structure. ©NIIT SQL/Lesson 6/Slide 12 of 50
13.
Manage Data in
Tables Task List Identify how the data entry task can be simplified Draft the statement to create a default Create the default Bind the default to the column Verify the default by adding a row with the DEFAULT value ©NIIT SQL/Lesson 6/Slide 13 of 50
14.
Manage Data in
Tables Identify how the data entry task can be simplified Default It is a constant value assigned to a column, into which the user need not insert values Result: The data entry task can be simplified by using defaults ©NIIT SQL/Lesson 6/Slide 14 of 50
15.
Manage Data in
Tables Draft the statement to create a default The CREATE DEFAULT Statement Syntax CREATE DEFAULT default_name AS constant_expression Action: The default would be applied on the Newspaper table The column on which the default would be applied is cCountryCode The default value is '001’ ©NIIT SQL/Lesson 6/Slide 15 of 50
16.
Manage Data in
Tables Draft the statement to create a default (Contd.) The code for creating the default can be written as CREATE DEFAULT defCountry AS '001' ©NIIT SQL/Lesson 6/Slide 16 of 50
17.
Manage Data in
Tables Create the default Action: In the Query Analyzer window, type the query Press F5 to execute the code ©NIIT SQL/Lesson 6/Slide 17 of 50
18.
Manage Data in
Tables Bind the default to a column Binding Defaults - After a DEFAULT is created, it needs to be bound to a column or a user-defined datatype Syntax sp_bindefault default_name, object_name [, FUTUREONLY] Unbinding Defaults - Defaults can be unbound from a column or user-defined datatype using the sp_unbindefault system stored procedure Syntax sp_unbindefault object_name [, FUTUREONLY] ©NIIT SQL/Lesson 6/Slide 18 of 50
19.
Manage Data in
Tables Bind the default to a column (Contd.) Action: In the Query Analyzer, type: sp_bindefault defCountry,'Newspaper.cCountryCode' Press F5 to execute the code ©NIIT SQL/Lesson 6/Slide 19 of 50
20.
Manage Data in
Tables Verify the default by adding a row with the DEFAULT value Action: In the Query Analyzer, type: INSERT INTO Newspaper VALUES('0008','Kansas Today','Kansas','Genral','Robin Paul','1925 Shawnee Dr ','Kansas City','Kansas','66106-3025',DEFAULT,'(913) 362-9529','(913)362-9515') Press F5 to execute ©NIIT SQL/Lesson 6/Slide 20 of 50
21.
Manage Data in
Tables Maintaining Databases Data Manipulation Language - Data manipulation involves inserting, modifying, and deleting data. The Data Manipulation Language (DML) of Transact–SQL is used to manipulate data The three operations that you will typically perform to maintain a database are: Insert Rows Update Rows Delete Rows ©NIIT SQL/Lesson 6/Slide 21 of 50
22.
Manage Data in
Tables 6.D.3 Storing Details in a Table Recruitment of candidates is done through recruitment agencies. One of the new recruitment agencies is called ‘Head Hunters’. The details of the Head Hunters are: Attributes Data Agency Code 0010 Name Head Hunters Address 223 Hill Street City Cleveland State Ohio Zip 44167-5943 Phone (440)345-8872 Fax (440)345-8943 Charge 7 Total Paid 1000 The above details are required to be stored in the RecruitmentAgencies table ©NIIT SQL/Lesson 6/Slide 22 of 50
23.
Manage Data in
Tables Task List Decide in which table the information is to be added Identify the values to be inserted Insert rows into the table Query the table to verify that data has been inserted ©NIIT SQL/Lesson 6/Slide 23 of 50
24.
Manage Data in
Tables Decide in which table the information is to be added Result: The information is to be added in the RecruitmentAgencies table ©NIIT SQL/Lesson 6/Slide 24 of 50
25.
Manage Data in
Tables Identify the values to be inserted Result: In the RecruitmentAgencies table, the values to be inserted are: cAgencyCode = '0010' cName = ‘Head Hunters ', vAddress = ‘223 Hill Street ', cCity = 'Cleveland', cState = ‘Ohio’ cZip = '44167-5943', cPhone = '(440)345-8872', cFax = '(440)345-8943', siPercentageCharge = 7, mTotalPaid = 1000 ©NIIT SQL/Lesson 6/Slide 25 of 50
26.
Manage Data in
Tables Insert rows into the table The INSERT Statement You must add data to the database to maintain the latest information about the organization and the transactions performed by it. This is done using the INSERT statement Syntax INSERT [INTO]{table_name}[(column_list)] VALUES {DEFAULT values_list|select_statement} ©NIIT SQL/Lesson 6/Slide 26 of 50
27.
Manage Data in
Tables Insert rows into the table (Contd.) Action: In the Query Analyzer Window, type: INSERT INTO RecruitmentAgencies VALUES('0010','Head Hunters','223 Hill Street','Cleveland', 'Ohio','44167- 5943','(440)345-8872','(440)345- 8943',7,1000) Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 27 of 50
28.
Manage Data in
Tables Query the table to verify that data has been inserted Action: In the Query Analyzer window, type: SELECT * FROM RecruitmentAgencies Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 28 of 50
29.
Manage Data in
Tables 6.D.4 Storing Data From an Existing Table Into a new Table Data for the external candidates with a rating of eight or above from the ExternalCandidate table is to be copied into a new table called PreferredCandidate. (The PreferredCandidate table does not exist). After the PreferredCandidate table has been created with the required values, it needs to be updated by adding rows of external candidates with a rating of seven. ©NIIT SQL/Lesson 6/Slide 29 of 50
30.
Manage Data in
Tables Task List Identify rows to be inserted Create the new table with the selected values Add more rows to the table that has been created Query the table to check if the rows have been added ©NIIT SQL/Lesson 6/Slide 30 of 50
31.
Manage Data in
Tables Identify rows to be inserted Result: The rows to be inserted are of those candidates with a rating of eight or above from the ExternalCandidate table ©NIIT SQL/Lesson 6/Slide 31 of 50
32.
Manage Data in
Tables Create the new table with the selected values The SELECT INTO Statement is used to copy contents of one table into another table Syntax SELECT columns_list INTO new_table_name FROM table_names WHERE conditions Action: In the Query Analyzer window, type: SELECT * INTO PreferredCandidate FROM ExternalCandidate WHERE cRating = 8 Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 32 of 50
33.
Manage Data in
Tables Add more rows to the table that has been created The INSERT INTO Statement is used to add data from one table to another Syntax INSERT [INTO] table_name1 SELECT column_name(s) FROM table_name2 [WHERE condition] Action: In the Query Analyzer window, type: INSERT INTO PreferredCandidate SELECT * FROM ExternalCandidate WHERE cRating = 7 Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 33 of 50
34.
Manage Data in
Tables Query the table to check if the rows have been added Action: In the Query Analyzer window, type: SELECT * FROM PreferredCandidate Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 34 of 50
35.
Manage Data in
Tables Just a Minute… Which statements allow you to copy contents of one table into another table? ©NIIT SQL/Lesson 6/Slide 35 of 50
36.
Manage Data in
Tables 6.D.5 Updating a Table The test score of Jane Schaffer who is an external candidate (cCandidateCode 000049) is to be increased by 2 marks, due to an error detected in the test correction process. ©NIIT SQL/Lesson 6/Slide 36 of 50
37.
Manage Data in
Tables Task List Identify attributes that have to be updated Identify values to be updated Update rows Query tables ©NIIT SQL/Lesson 6/Slide 37 of 50
38.
Manage Data in
Tables Identify attributes that have to be updated Result: In the ExternalCandidate table, the siTestScore attribute has to be updated ©NIIT SQL/Lesson 6/Slide 38 of 50
39.
Manage Data in
Tables Identify values to be updated Result: The test score of Jane Schaffer who is an external candidate is to be increased by 2 marks. The cCandidateCode of Jane is 000049 ©NIIT SQL/Lesson 6/Slide 39 of 50
40.
Manage Data in
Tables Update rows The UPDATE Statement is used to modify data in a database Syntax UPDATE table_name SET column_name = value[,column_name = value] [FROM table_name] [WHERE condition] Action: In the Query Analyzer window, type: UPDATE ExternalCandidate SET siTestScore=siTestScore+2 WHERE cCandidateCode='000049' Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 40 of 50
41.
Manage Data in
Tables Query Tables Action: In the Query Analyzer window, type: SELECT * from ExternalCandidate WHERE cCandidateCode = '000049' Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 41 of 50
42.
Manage Data in
Tables 6.D.6 Deleting Data The ExternalCandidate table contains data on all external candidates who were rejected after the entrance test. Some of the data in this table present now is more than two years old. It is occupying hard disk space that can be used for some other purpose. This data is not required anymore. You are required to ensure that this old data is removed from the ExternalCandidate table. ©NIIT SQL/Lesson 6/Slide 42 of 50
43.
Manage Data in
Tables Task List Identify rows that need to be deleted Delete the row(s) Query the table ©NIIT SQL/Lesson 6/Slide 43 of 50
44.
Manage Data in
Tables Identify rows that need to be deleted Result: The rows containing data about the candidates who took the entrance test more than two years ago ©NIIT SQL/Lesson 6/Slide 44 of 50
45.
Manage Data in
Tables Delete the row(s) The DELETE Statement is used to delete a row from a table Syntax DELETE [FROM] table_name [ FROM table(s)] [WHERE condition] Action: In the Query Analyzer window, type: DELETE FROM ExternalCandidate WHERE dTestDate dateadd(yy,-2,getdate()) Press F5 to execute the query ©NIIT SQL/Lesson 6/Slide 45 of 50
46.
Manage Data in
Tables Query the table Action: In the Query Analyzer window, type: SELECT * FROM ExternalCandidate WHERE dTestDate dateadd(yy,-2,getdate()) Press F5 to execute ©NIIT SQL/Lesson 6/Slide 46 of 50
47.
Manage Data in
Tables Just a Minute… Which statement allows the modification of data in a database? ©NIIT SQL/Lesson 6/Slide 47 of 50
48.
Manage Data in
Tables Truncating a Table The TRUNCATE TABLE statement Is used to remove rows from a table Is identical (functionally) to the DELETE statement Is faster than DELETE statement Does not fire a trigger ® Syntax TRUNCATE TABLE table_name ©NIIT SQL/Lesson 6/Slide 48 of 50
49.
Manage Data in
Tables Summary In this lesson, you learned that: Rules and defaults are objects that are bound to columns or user-defined datatypes for specifying the restricted values and default values respectively A rule is created using the CREATE RULE statement, and bound to the column and user-defined datatypes using the sp_bindrule procedure A rule is unbound using the sp_unbindrule procedure A default is created using the CREATE DEFAULT statement, and bound to the column and user-defined datatypes using the sp_bindefault procedure ©NIIT SQL/Lesson 6/Slide 49 of 50
50.
Manage Data in
Tables Summary (Contd.) A default is unbound using the sp_unbindefault procedure Data is modified in the database to keep the data up-to-date The INSERT statement is used to insert rows into tables You can copy contents of one table into another table by using the SELECT INTO command SQL Server provides a row update statement called UPDATE to modify values within tables You can delete a row from a table by using the DELETE statement You use the TRUNCATE TABLE statement to remove all the rows from a table ©NIIT SQL/Lesson 6/Slide 50 of 50
Baixar agora