7. How to write SQL Query to Modify an existing table , alter and drop Query crash course in SQL.

preview_player
Показать описание
In this video I show you how to write SQL using SQL Server and SQL Server Management Studio. SQL tutorial for beginners - Learn SQL, the world's most popular open source database.
7. How to write SQL Query to Modify an existing table , alter and drop Query
In this video I show you how to write SQL using SQL Server and SQL Server Management Studio.
--7. Modify an existing table by using ALTER
--1. you can add new column
--3. drop an existing column
A crash course in SQL. How to write SQL from scratch in 5 min.

--exercise 1 ADD A NEW COLUMN NAMED DateofRegistration with DATE and data type

USE Test
Go
ALTER TABLE Student
ADD DateofRegistration DATE

select* FROM student

--MODIFY THE DATA SIZE FOR LASTNAME AND FIRST NAME to 40 characters (40)

USE Test
GO
ALTER TABLE Student
ALTER COLUMN FirstName varchar(40)
ALTER TABLE Student
ALTER COLUMN LastName varchar(40)

--DROP DateofRegistration column
USE Test
GO
ALTER Table Student
DROP COLUMN dateofRegistration
select * from Student
Рекомендации по теме