SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
SQL
ALTER TABLE,
SELECT DISTINCT &
WHERE VIDEO
ALTER TABLE
• The ALTER TABLE statement is used to add, delete, or modify
columns in an existing table.
• The ALTER TABLE statement is also used to add and drop
various constraints on an existing table.
• ADD COLUMN
• DROP COLUMN
• ALTER/MODIFY COLUMN
ADD
COLUM
N
• ALTER TABLE table_name ADD column_name
datatype;
Syntax:
• ALTER TABLE Customers ADD Email
varchar(255);
Example:
DROP
COLUM
N
• ALTER TABLE table_name
DROP COLUMN
column_name;
Syntax:
• ALTER TABLE Customers
DROP COLUMN Email;
Example:
ALTER
COLUM
N
• ALTER TABLE table_name
ALTER COLUMN
column_name datatype;
Syntax:
• ALTER TABLE Persons
ALTER COLUMN DateOfBirth
year;
Example:
SELECT DISTINCT
• The SELECT DISTINCT statement is used to return only distinct
(different) values.
• Inside a table, a column often contains many duplicate values;
and sometimes you only want to list the different (distinct)
values.
Syntax:
SELECT DISTINCT column1, column2, ... FROM
table_name;
Example:
WHERE
• The WHERE clause is used to filter records.
• It is used to extract only those records that fulfill a specified
condition.
Syntax:
SELECT column1, column2, ... FROM table_name
WHERE condition;
Example:
SELECT * FROM Customers WHERE Country='Mexico';
SELECT * FROM Customers WHERE CustomerID=1;

More Related Content

DOCX
COMPUTERS SQL
PPTX
Oracle: DML
PPT
Sql basics and DDL statements
PPTX
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
PPT
SQL Tutorial - How To Create, Drop, and Truncate Table
COMPUTERS SQL
Oracle: DML
Sql basics and DDL statements
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
SQL Tutorial - How To Create, Drop, and Truncate Table

What's hot (20)

PPTX
SQL(DDL & DML)
PPTX
Oracle Database DML DDL and TCL
PPTX
Oracle: DDL
PPT
SQL DDL
PPTX
Database Management - Lecture 2 - SQL select, insert, update and delete
PPTX
Oracle SQL DML Statements
PPTX
8. sql
PPT
Sql DML
PDF
Sql commands
PPTX
Commands of DML in SQL
ODP
PPTX
Creating database using sql commands
PPT
Sql dml & tcl 2
PPTX
SQL - DML and DDL Commands
DOCX
Ddl commands
PDF
Database Systems - SQL - DDL Statements (Chapter 3/2)
PPTX
PPTX
DDL,DML,SQL Functions and Joins
PPT
SQL Tutorial - Basic Commands
PPTX
Avinash database
SQL(DDL & DML)
Oracle Database DML DDL and TCL
Oracle: DDL
SQL DDL
Database Management - Lecture 2 - SQL select, insert, update and delete
Oracle SQL DML Statements
8. sql
Sql DML
Sql commands
Commands of DML in SQL
Creating database using sql commands
Sql dml & tcl 2
SQL - DML and DDL Commands
Ddl commands
Database Systems - SQL - DDL Statements (Chapter 3/2)
DDL,DML,SQL Functions and Joins
SQL Tutorial - Basic Commands
Avinash database
Ad

Similar to SQL-Alter Table, SELECT DISTINCT & WHERE (20)

PPTX
data base programming chapter2 29 slides
PPTX
2..basic queries.pptx
PPTX
Unit - II.pptx
PPT
UNIT2.ppt
PPTX
DBMS UNIT-2.pptx ggggggggggggggggggggggg
PPTX
Introduction to database and sql fir beginers
PPTX
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
PPTX
SQL Assessment Command Statements
PDF
Creating, altering and dropping tables
PPTX
SQL _UNIT_DBMS_PRESENTSTATION_SQL _UNIT_DBMS_PRESENTSTATION
PPTX
SQL : Structured Query Language
PPTX
Data Definition Language Commands in DBMS
PDF
Sql alter table statement
PPT
DDL. data defination language for creating database
PPTX
MySQL Essential Training
DOCX
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
PPTX
SQL: Data Definition Language(DDL) command
PPTX
ms-sql-server-150223140402-conversion-gate02.pptx
PDF
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
ODP
Ms sql-server
data base programming chapter2 29 slides
2..basic queries.pptx
Unit - II.pptx
UNIT2.ppt
DBMS UNIT-2.pptx ggggggggggggggggggggggg
Introduction to database and sql fir beginers
4 SQL DML.pptx ASHEN WANNIARACHCHI USESS
SQL Assessment Command Statements
Creating, altering and dropping tables
SQL _UNIT_DBMS_PRESENTSTATION_SQL _UNIT_DBMS_PRESENTSTATION
SQL : Structured Query Language
Data Definition Language Commands in DBMS
Sql alter table statement
DDL. data defination language for creating database
MySQL Essential Training
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
SQL: Data Definition Language(DDL) command
ms-sql-server-150223140402-conversion-gate02.pptx
Complete SQL Tutorial In Hindi By Rishabh Mishra (Basic to Advance).pdf
Ms sql-server
Ad

Recently uploaded (20)

PPTX
Pharma ospi slides which help in ospi learning
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Institutional Correction lecture only . . .
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Insiders guide to clinical Medicine.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Pre independence Education in Inndia.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Business Ethics Teaching Materials for college
PDF
01-Introduction-to-Information-Management.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
Pharma ospi slides which help in ospi learning
Renaissance Architecture: A Journey from Faith to Humanism
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Institutional Correction lecture only . . .
Week 4 Term 3 Study Techniques revisited.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Insiders guide to clinical Medicine.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Microbial disease of the cardiovascular and lymphatic systems
VCE English Exam - Section C Student Revision Booklet
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pre independence Education in Inndia.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Business Ethics Teaching Materials for college
01-Introduction-to-Information-Management.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
O5-L3 Freight Transport Ops (International) V1.pdf

SQL-Alter Table, SELECT DISTINCT & WHERE

  • 2. ALTER TABLE • The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. • The ALTER TABLE statement is also used to add and drop various constraints on an existing table. • ADD COLUMN • DROP COLUMN • ALTER/MODIFY COLUMN
  • 3. ADD COLUM N • ALTER TABLE table_name ADD column_name datatype; Syntax: • ALTER TABLE Customers ADD Email varchar(255); Example:
  • 4. DROP COLUM N • ALTER TABLE table_name DROP COLUMN column_name; Syntax: • ALTER TABLE Customers DROP COLUMN Email; Example:
  • 5. ALTER COLUM N • ALTER TABLE table_name ALTER COLUMN column_name datatype; Syntax: • ALTER TABLE Persons ALTER COLUMN DateOfBirth year; Example:
  • 6. SELECT DISTINCT • The SELECT DISTINCT statement is used to return only distinct (different) values. • Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values. Syntax: SELECT DISTINCT column1, column2, ... FROM table_name; Example:
  • 7. WHERE • The WHERE clause is used to filter records. • It is used to extract only those records that fulfill a specified condition. Syntax: SELECT column1, column2, ... FROM table_name WHERE condition; Example: SELECT * FROM Customers WHERE Country='Mexico'; SELECT * FROM Customers WHERE CustomerID=1;