SlideShare una empresa de Scribd logo
1 de 14
4 SQL SERVER: MANIPULATING A DATABASE
Manipulating a Database HOW TO MAKE CHANGES TO THE STRUCTURE OF THE DATABASE? A Database table can be defined by: The Fields(Columns) and their properties Records(Rows) and their properties It is important to understand clearly that the records are user-entries into a database table. Fields are created during the design phase of a database Now let us see how to carry out the changes to the above defined properties of a database.
Modifying the Columns The Columns or fields in a database table can be easily modified using the ‘alter table’ command, which comes under DDL(Data Definition Language) What are the changes that can be made to a field? ,[object Object]
Edit an existing field
Remove a field from table
Add a constraint on the data that a field can hold (will be dealt with later)Now lets see how these actions can be performed in SQL Server 2008
Add a new field The SQL DDL command ‘alter table…add’ is used for adding a new field alter table <tableName> add <field name> <field type>; For example, consider the following animal database used by ‘MetaZooa’  Zoo, for maintaining the details of the animals in the zoo.
Add a new field Now, suppose the MetaZooa corp. decides to construct another Zoo beside the old one and divide the animals between the zoos. Then, the database of MetaZooa must contain details of the zoo-number also.
Add a new field Steps to add a new field Considering the previous example, the command will be: alter table MetaZooDBaddZoo int; Run this command using ‘Go’ command.
Modifying an existing field Now, suppose MetaZooa decides to that ‘Zoo’ contains the Zoo Name rather than the number ‘1’ or ‘2’, we need to modify the field type. The Command is: alter table MetaZooDBalter column Zoo varchar(15); Run this command using ‘Go’ command. But we might have complications…
Modifying an existing field Problem: The Data contained in the field that is to be modified must be compatible with the destination data-type. Other-wise, conversion cannot be carried out Compatibility Chart Source Destination Source Varchar (Strings) Integers (Int) Varchar (Strings) Integers (Int) Legend: Conversion Allowed: Conversion NOT allowed: Decimals (Float) Date and Time
Modifying an existing field Source Destination Source Varchar (Strings) Decimals (Float) Date and Time Integers (Int) Decimals (Float) Date and Time
Remove a column from table The DDL command ‘alter table’ in conjunction with the ‘drop column’ is used to delete a column/field from a user table. The Syntax is: alter table <table_name> drop column <column_name> For example, consider the follwingDreamTable. Suppose the User wishes to remove the DreamType field…  alter table DreamTable drop column DreamType
Deleting a Row A Record is a row in a table. For example, consider a fish database maintained by a ‘Eden-Lake Ecology farm’.  Now, suppose the people go on a shark-mania and the sharp population vanished from the lake, it is meaningful for the Eco farm to remove its entry from the database. Now let us see the command

Más contenido relacionado

La actualidad más candente

Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statementsMohd Tousif
 
Import and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R StudioImport and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R StudioRupak Roy
 
Import and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R StudioImport and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R StudioRupak Roy
 
SQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHERESQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHEREI L0V3 CODING DR
 
Procedure To Store Database Object Size And Number Of Rows In Custom Table
Procedure To Store Database Object Size And Number Of Rows In Custom TableProcedure To Store Database Object Size And Number Of Rows In Custom Table
Procedure To Store Database Object Size And Number Of Rows In Custom TableAhmed Elshayeb
 
Manipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R StudioManipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R StudioRupak Roy
 
Import Data using R
Import Data using R Import Data using R
Import Data using R Rupak Roy
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic ConceptsTony Wong
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasadpaddu123
 

La actualidad más candente (16)

Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
MySQL lecture
MySQL lectureMySQL lecture
MySQL lecture
 
Import and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R StudioImport and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R Studio
 
Import and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R StudioImport and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R Studio
 
SQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHERESQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHERE
 
Procedure To Store Database Object Size And Number Of Rows In Custom Table
Procedure To Store Database Object Size And Number Of Rows In Custom TableProcedure To Store Database Object Size And Number Of Rows In Custom Table
Procedure To Store Database Object Size And Number Of Rows In Custom Table
 
DML Commands
DML CommandsDML Commands
DML Commands
 
Oracle: DDL
Oracle: DDLOracle: DDL
Oracle: DDL
 
Les11 Including Constraints
Les11 Including ConstraintsLes11 Including Constraints
Les11 Including Constraints
 
Stata tutorial university of princeton
Stata tutorial university of princetonStata tutorial university of princeton
Stata tutorial university of princeton
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
Les10
Les10Les10
Les10
 
Manipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R StudioManipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R Studio
 
Import Data using R
Import Data using R Import Data using R
Import Data using R
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 

Destacado

MS SQLSERVER:Creating A Database
MS SQLSERVER:Creating A DatabaseMS SQLSERVER:Creating A Database
MS SQLSERVER:Creating A Databasesqlserver content
 
MS SQL SERVER: Feeding Data Into Database
MS SQL SERVER: Feeding Data Into DatabaseMS SQL SERVER: Feeding Data Into Database
MS SQL SERVER: Feeding Data Into Databasesqlserver content
 
MS Sql Server: Reporting basics
MS Sql  Server: Reporting basicsMS Sql  Server: Reporting basics
MS Sql Server: Reporting basicssqlserver content
 
MS SQL SERVER: Getting Started With Sql Server 2008
MS SQL SERVER: Getting Started With Sql Server 2008MS SQL SERVER: Getting Started With Sql Server 2008
MS SQL SERVER: Getting Started With Sql Server 2008sqlserver content
 
MS SQL SERVER: Doing Calculations With Functions
MS SQL SERVER: Doing Calculations With FunctionsMS SQL SERVER: Doing Calculations With Functions
MS SQL SERVER: Doing Calculations With Functionssqlserver content
 
MS SQLSERVER:Manipulating Database
MS SQLSERVER:Manipulating DatabaseMS SQLSERVER:Manipulating Database
MS SQLSERVER:Manipulating Databasesqlserver content
 
MS SQLSERVER:Doing Calculations With Functions
MS SQLSERVER:Doing Calculations With FunctionsMS SQLSERVER:Doing Calculations With Functions
MS SQLSERVER:Doing Calculations With Functionssqlserver content
 
MS Sql Server: Reporting introduction
MS Sql Server: Reporting introductionMS Sql Server: Reporting introduction
MS Sql Server: Reporting introductionsqlserver content
 
MS SQL SERVER: Creating A Database
MS SQL SERVER: Creating A DatabaseMS SQL SERVER: Creating A Database
MS SQL SERVER: Creating A Databasesqlserver content
 
MS Sql Server: Reporting models
MS Sql Server: Reporting modelsMS Sql Server: Reporting models
MS Sql Server: Reporting modelssqlserver content
 
MS SQL SERVER: Joining Databases
MS SQL SERVER: Joining DatabasesMS SQL SERVER: Joining Databases
MS SQL SERVER: Joining Databasessqlserver content
 
MS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A DatabaseMS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A Databasesqlserver content
 
MS SQLSERVER:Advanced Query Concepts Copy
MS SQLSERVER:Advanced Query Concepts   CopyMS SQLSERVER:Advanced Query Concepts   Copy
MS SQLSERVER:Advanced Query Concepts Copysqlserver content
 
MS SQL SERVER: Advanced Query Concepts Copy
MS SQL SERVER: Advanced Query Concepts   CopyMS SQL SERVER: Advanced Query Concepts   Copy
MS SQL SERVER: Advanced Query Concepts Copysqlserver content
 
MS SQL SERVER: Neural network and logistic regression
MS SQL SERVER: Neural network and logistic regressionMS SQL SERVER: Neural network and logistic regression
MS SQL SERVER: Neural network and logistic regressionsqlserver content
 
MS SQL SERVER: Programming sql server data mining
MS SQL SERVER:  Programming sql server data miningMS SQL SERVER:  Programming sql server data mining
MS SQL SERVER: Programming sql server data miningsqlserver content
 
MS SQLSERVER:Feeding Data Into Database
MS SQLSERVER:Feeding Data Into DatabaseMS SQLSERVER:Feeding Data Into Database
MS SQLSERVER:Feeding Data Into Databasesqlserver content
 
MS SQLSERVER:Joining Databases
MS SQLSERVER:Joining DatabasesMS SQLSERVER:Joining Databases
MS SQLSERVER:Joining Databasessqlserver content
 
MS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A DatabaseMS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A Databasesqlserver content
 
MS SQL SERVER: Creating Views
MS SQL SERVER: Creating ViewsMS SQL SERVER: Creating Views
MS SQL SERVER: Creating Viewssqlserver content
 

Destacado (20)

MS SQLSERVER:Creating A Database
MS SQLSERVER:Creating A DatabaseMS SQLSERVER:Creating A Database
MS SQLSERVER:Creating A Database
 
MS SQL SERVER: Feeding Data Into Database
MS SQL SERVER: Feeding Data Into DatabaseMS SQL SERVER: Feeding Data Into Database
MS SQL SERVER: Feeding Data Into Database
 
MS Sql Server: Reporting basics
MS Sql  Server: Reporting basicsMS Sql  Server: Reporting basics
MS Sql Server: Reporting basics
 
MS SQL SERVER: Getting Started With Sql Server 2008
MS SQL SERVER: Getting Started With Sql Server 2008MS SQL SERVER: Getting Started With Sql Server 2008
MS SQL SERVER: Getting Started With Sql Server 2008
 
MS SQL SERVER: Doing Calculations With Functions
MS SQL SERVER: Doing Calculations With FunctionsMS SQL SERVER: Doing Calculations With Functions
MS SQL SERVER: Doing Calculations With Functions
 
MS SQLSERVER:Manipulating Database
MS SQLSERVER:Manipulating DatabaseMS SQLSERVER:Manipulating Database
MS SQLSERVER:Manipulating Database
 
MS SQLSERVER:Doing Calculations With Functions
MS SQLSERVER:Doing Calculations With FunctionsMS SQLSERVER:Doing Calculations With Functions
MS SQLSERVER:Doing Calculations With Functions
 
MS Sql Server: Reporting introduction
MS Sql Server: Reporting introductionMS Sql Server: Reporting introduction
MS Sql Server: Reporting introduction
 
MS SQL SERVER: Creating A Database
MS SQL SERVER: Creating A DatabaseMS SQL SERVER: Creating A Database
MS SQL SERVER: Creating A Database
 
MS Sql Server: Reporting models
MS Sql Server: Reporting modelsMS Sql Server: Reporting models
MS Sql Server: Reporting models
 
MS SQL SERVER: Joining Databases
MS SQL SERVER: Joining DatabasesMS SQL SERVER: Joining Databases
MS SQL SERVER: Joining Databases
 
MS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A DatabaseMS SQL SERVER: Retrieving Data From A Database
MS SQL SERVER: Retrieving Data From A Database
 
MS SQLSERVER:Advanced Query Concepts Copy
MS SQLSERVER:Advanced Query Concepts   CopyMS SQLSERVER:Advanced Query Concepts   Copy
MS SQLSERVER:Advanced Query Concepts Copy
 
MS SQL SERVER: Advanced Query Concepts Copy
MS SQL SERVER: Advanced Query Concepts   CopyMS SQL SERVER: Advanced Query Concepts   Copy
MS SQL SERVER: Advanced Query Concepts Copy
 
MS SQL SERVER: Neural network and logistic regression
MS SQL SERVER: Neural network and logistic regressionMS SQL SERVER: Neural network and logistic regression
MS SQL SERVER: Neural network and logistic regression
 
MS SQL SERVER: Programming sql server data mining
MS SQL SERVER:  Programming sql server data miningMS SQL SERVER:  Programming sql server data mining
MS SQL SERVER: Programming sql server data mining
 
MS SQLSERVER:Feeding Data Into Database
MS SQLSERVER:Feeding Data Into DatabaseMS SQLSERVER:Feeding Data Into Database
MS SQLSERVER:Feeding Data Into Database
 
MS SQLSERVER:Joining Databases
MS SQLSERVER:Joining DatabasesMS SQLSERVER:Joining Databases
MS SQLSERVER:Joining Databases
 
MS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A DatabaseMS SQLSERVER:Retrieving Data From A Database
MS SQLSERVER:Retrieving Data From A Database
 
MS SQL SERVER: Creating Views
MS SQL SERVER: Creating ViewsMS SQL SERVER: Creating Views
MS SQL SERVER: Creating Views
 

Similar a SQL SERVER: MANIPULATING A DATABASE

Similar a SQL SERVER: MANIPULATING A DATABASE (20)

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...
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
SQL.ppt
SQL.pptSQL.ppt
SQL.ppt
 
DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptx
 
delta_lake_cheat_sheet.pdf
delta_lake_cheat_sheet.pdfdelta_lake_cheat_sheet.pdf
delta_lake_cheat_sheet.pdf
 
Les09
Les09Les09
Les09
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
Sql
SqlSql
Sql
 
Database models and DBMS languages
Database models and DBMS languagesDatabase models and DBMS languages
Database models and DBMS languages
 
Module 3
Module 3Module 3
Module 3
 
DeltaLakeOperations.pdf
DeltaLakeOperations.pdfDeltaLakeOperations.pdf
DeltaLakeOperations.pdf
 
Delta Lake Cheat Sheet.pdf
Delta Lake Cheat Sheet.pdfDelta Lake Cheat Sheet.pdf
Delta Lake Cheat Sheet.pdf
 
Disconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETDisconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NET
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sql
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sql
 

Más de sqlserver content

MS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsMS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolssqlserver content
 
MS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data miningMS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data miningsqlserver content
 
MS SQL SERVER: Olap cubes and data mining
MS SQL SERVER:  Olap cubes and data miningMS SQL SERVER:  Olap cubes and data mining
MS SQL SERVER: Olap cubes and data miningsqlserver content
 
MS SQL SERVER: Microsoft time series algorithm
MS SQL SERVER: Microsoft time series algorithmMS SQL SERVER: Microsoft time series algorithm
MS SQL SERVER: Microsoft time series algorithmsqlserver content
 
MS SQL SERVER: Microsoft sequence clustering and association rules
MS SQL SERVER: Microsoft sequence clustering and association rulesMS SQL SERVER: Microsoft sequence clustering and association rules
MS SQL SERVER: Microsoft sequence clustering and association rulessqlserver content
 
MS SQL SERVER: Microsoft naive bayes algorithm
MS SQL SERVER: Microsoft naive bayes algorithmMS SQL SERVER: Microsoft naive bayes algorithm
MS SQL SERVER: Microsoft naive bayes algorithmsqlserver content
 
MS SQL SERVER: Decision trees algorithm
MS SQL SERVER: Decision trees algorithmMS SQL SERVER: Decision trees algorithm
MS SQL SERVER: Decision trees algorithmsqlserver content
 
MS SQL Server: Data mining concepts and dmx
MS SQL Server: Data mining concepts and dmxMS SQL Server: Data mining concepts and dmx
MS SQL Server: Data mining concepts and dmxsqlserver content
 
MS Sql Server: Reporting manipulating data
MS Sql Server: Reporting manipulating dataMS Sql Server: Reporting manipulating data
MS Sql Server: Reporting manipulating datasqlserver content
 
MS Sql Server: Datamining Introduction
MS Sql Server: Datamining IntroductionMS Sql Server: Datamining Introduction
MS Sql Server: Datamining Introductionsqlserver content
 
MS Sql Server: Business Intelligence
MS Sql Server: Business IntelligenceMS Sql Server: Business Intelligence
MS Sql Server: Business Intelligencesqlserver content
 
MS SQLSERVER:Deleting A Database
MS SQLSERVER:Deleting A DatabaseMS SQLSERVER:Deleting A Database
MS SQLSERVER:Deleting A Databasesqlserver content
 
MS SQLSERVER:Customizing Your D Base Design
MS SQLSERVER:Customizing Your D Base DesignMS SQLSERVER:Customizing Your D Base Design
MS SQLSERVER:Customizing Your D Base Designsqlserver content
 
MS SQLSERVER:Sql Functions And Procedures
MS SQLSERVER:Sql Functions And ProceduresMS SQLSERVER:Sql Functions And Procedures
MS SQLSERVER:Sql Functions And Proceduressqlserver content
 
MS SQL SERVER: Sql Functions And Procedures
MS SQL SERVER: Sql Functions And ProceduresMS SQL SERVER: Sql Functions And Procedures
MS SQL SERVER: Sql Functions And Proceduressqlserver content
 

Más de sqlserver content (16)

MS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsMS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining tools
 
MS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data miningMS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data mining
 
MS SQL SERVER: Olap cubes and data mining
MS SQL SERVER:  Olap cubes and data miningMS SQL SERVER:  Olap cubes and data mining
MS SQL SERVER: Olap cubes and data mining
 
MS SQL SERVER: Microsoft time series algorithm
MS SQL SERVER: Microsoft time series algorithmMS SQL SERVER: Microsoft time series algorithm
MS SQL SERVER: Microsoft time series algorithm
 
MS SQL SERVER: Microsoft sequence clustering and association rules
MS SQL SERVER: Microsoft sequence clustering and association rulesMS SQL SERVER: Microsoft sequence clustering and association rules
MS SQL SERVER: Microsoft sequence clustering and association rules
 
MS SQL SERVER: Microsoft naive bayes algorithm
MS SQL SERVER: Microsoft naive bayes algorithmMS SQL SERVER: Microsoft naive bayes algorithm
MS SQL SERVER: Microsoft naive bayes algorithm
 
MS SQL SERVER: Decision trees algorithm
MS SQL SERVER: Decision trees algorithmMS SQL SERVER: Decision trees algorithm
MS SQL SERVER: Decision trees algorithm
 
MS SQL Server: Data mining concepts and dmx
MS SQL Server: Data mining concepts and dmxMS SQL Server: Data mining concepts and dmx
MS SQL Server: Data mining concepts and dmx
 
MS Sql Server: Reporting manipulating data
MS Sql Server: Reporting manipulating dataMS Sql Server: Reporting manipulating data
MS Sql Server: Reporting manipulating data
 
MS Sql Server: Datamining Introduction
MS Sql Server: Datamining IntroductionMS Sql Server: Datamining Introduction
MS Sql Server: Datamining Introduction
 
MS Sql Server: Business Intelligence
MS Sql Server: Business IntelligenceMS Sql Server: Business Intelligence
MS Sql Server: Business Intelligence
 
MS SQLSERVER:Deleting A Database
MS SQLSERVER:Deleting A DatabaseMS SQLSERVER:Deleting A Database
MS SQLSERVER:Deleting A Database
 
MS SQLSERVER:Customizing Your D Base Design
MS SQLSERVER:Customizing Your D Base DesignMS SQLSERVER:Customizing Your D Base Design
MS SQLSERVER:Customizing Your D Base Design
 
MS SQLSERVER:Creating Views
MS SQLSERVER:Creating ViewsMS SQLSERVER:Creating Views
MS SQLSERVER:Creating Views
 
MS SQLSERVER:Sql Functions And Procedures
MS SQLSERVER:Sql Functions And ProceduresMS SQLSERVER:Sql Functions And Procedures
MS SQLSERVER:Sql Functions And Procedures
 
MS SQL SERVER: Sql Functions And Procedures
MS SQL SERVER: Sql Functions And ProceduresMS SQL SERVER: Sql Functions And Procedures
MS SQL SERVER: Sql Functions And Procedures
 

Último

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Último (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

SQL SERVER: MANIPULATING A DATABASE

  • 1. 4 SQL SERVER: MANIPULATING A DATABASE
  • 2. Manipulating a Database HOW TO MAKE CHANGES TO THE STRUCTURE OF THE DATABASE? A Database table can be defined by: The Fields(Columns) and their properties Records(Rows) and their properties It is important to understand clearly that the records are user-entries into a database table. Fields are created during the design phase of a database Now let us see how to carry out the changes to the above defined properties of a database.
  • 3.
  • 5. Remove a field from table
  • 6. Add a constraint on the data that a field can hold (will be dealt with later)Now lets see how these actions can be performed in SQL Server 2008
  • 7. Add a new field The SQL DDL command ‘alter table…add’ is used for adding a new field alter table <tableName> add <field name> <field type>; For example, consider the following animal database used by ‘MetaZooa’ Zoo, for maintaining the details of the animals in the zoo.
  • 8. Add a new field Now, suppose the MetaZooa corp. decides to construct another Zoo beside the old one and divide the animals between the zoos. Then, the database of MetaZooa must contain details of the zoo-number also.
  • 9. Add a new field Steps to add a new field Considering the previous example, the command will be: alter table MetaZooDBaddZoo int; Run this command using ‘Go’ command.
  • 10. Modifying an existing field Now, suppose MetaZooa decides to that ‘Zoo’ contains the Zoo Name rather than the number ‘1’ or ‘2’, we need to modify the field type. The Command is: alter table MetaZooDBalter column Zoo varchar(15); Run this command using ‘Go’ command. But we might have complications…
  • 11. Modifying an existing field Problem: The Data contained in the field that is to be modified must be compatible with the destination data-type. Other-wise, conversion cannot be carried out Compatibility Chart Source Destination Source Varchar (Strings) Integers (Int) Varchar (Strings) Integers (Int) Legend: Conversion Allowed: Conversion NOT allowed: Decimals (Float) Date and Time
  • 12. Modifying an existing field Source Destination Source Varchar (Strings) Decimals (Float) Date and Time Integers (Int) Decimals (Float) Date and Time
  • 13. Remove a column from table The DDL command ‘alter table’ in conjunction with the ‘drop column’ is used to delete a column/field from a user table. The Syntax is: alter table <table_name> drop column <column_name> For example, consider the follwingDreamTable. Suppose the User wishes to remove the DreamType field… alter table DreamTable drop column DreamType
  • 14. Deleting a Row A Record is a row in a table. For example, consider a fish database maintained by a ‘Eden-Lake Ecology farm’. Now, suppose the people go on a shark-mania and the sharp population vanished from the lake, it is meaningful for the Eco farm to remove its entry from the database. Now let us see the command
  • 15. Deleting a Row Deleting a row: For deleting a row, it must be identified using a ‘distinguishing’ attribute which lets the computer tell it apart from other records. For the above example, the record can be identified using: The Primary key (FishID) Or any other special attribute (like Fish Name). But in general, always use the Primary Key, as it is best suited for uniquely identifying a record in a database table. NOTE: Strings/Date data-types must be encapsulated within single quotes delete from <table_name> where <condition> delete from EdenFishTable where FishID = ‘23H’
  • 16.
  • 23.