SQL Server Eng PART3
SQL Server Eng PART3
Created by Ajay Parmar
Course Description
DDL (Data Definition Language)
-
DDL is used to define and modify database structures (schemas).
-
Main DDL commands:
CREATE,ALTER,DROP,TRUNCATE,RENAME. -
CREATEis used to make new tables, views, stored procedures, functions, etc. -
ALTERmodifies existing objects like adding/dropping columns, changing data types. -
DROPpermanently deletes database objects. -
TRUNCATEremoves all rows from a table but keeps the structure; faster thanDELETE. -
DDL commands auto-commit — you can’t roll them back without explicit transaction control.
-
CREATE TABLEshould include primary key and constraints for best practice. -
You can use
IF EXISTSwithDROPorCREATEto avoid errors. -
CREATE INDEXimproves performance for read-heavy queries. -
Always take a backup before applying DDL changes in production.
-
ALTER TABLEallows adding constraints (PK, FK, CHECK) after table creation. -
Use
sp_helporINFORMATION_SCHEMA.TABLESto check object structure. -
You can generate DDL scripts from SSMS by right-clicking on the object.
-
Constraints like
UNIQUE,NOT NULL,DEFAULTare added via DDL. -
You can use
CREATE SCHEMAto organize tables under logical groups. -
Follow naming conventions when creating objects for consistency and clarity.
- Interview Questions with solutions
🔹 DML (Data Manipulation Language)
-
DML commands are used to modify and retrieve data in existing tables.
-
Main DML commands include
SELECT,INSERT,UPDATE,DELETE, andMERGE. -
SELECTis used to retrieve data from one or more tables or views. -
INSERTis used to add new records into a table. -
You can insert single or multiple rows in one
INSERTstatement. -
UPDATEmodifies existing records based on conditions using theWHEREclause. -
Always use a
WHEREclause inUPDATEto avoid updating all rows. -
DELETEremoves records based on a condition, but the table structure remains. -
Without a
WHEREclause,DELETEremoves all records — use cautiously. -
MERGEcombinesINSERT,UPDATE, andDELETEin a single query (though you prefer not to use it, it’s worth mentioning). -
Transactions can be applied to DML commands (
BEGIN TRAN,COMMIT,ROLLBACK).
Course Curriculum
SQL SERVER
-
InterviewQuestions Part1
00:00 -
InterviewQuestions Part2
00:00 -
InterviewQuestions Part3
00:00 -
InterviewQuestions Part4
00:00 -
DML_DDL and Database Schema Table_introduction
00:00 -
Create_Drop_Databases_Tables_Schema
00:00 -
Create Copy Table
00:00 -
Rename Columns_Delete
00:00 -
Update SQL
00:00 -
Update SQL CustomerTable ShowDiscount
00:00 -
Update Customer Order Quantities
00:00 -
insert Sql Part1
00:00 -
select Into query Project Part2
00:00 -
Project_add Pending orders Part3
00:00 -
import excel UsingSQL Solution Chatgpt_Part4
00:00
-
LevelExpert
-
Total Enrolled14
-
Last UpdatedMay 10, 2025
SQL Server Eng PART3
-
LevelExpert
-
Total Enrolled14
-
Last UpdatedMay 10, 2025
Course Description
DDL (Data Definition Language)
-
DDL is used to define and modify database structures (schemas).
-
Main DDL commands:
CREATE,ALTER,DROP,TRUNCATE,RENAME. -
CREATEis used to make new tables, views, stored procedures, functions, etc. -
ALTERmodifies existing objects like adding/dropping columns, changing data types. -
DROPpermanently deletes database objects. -
TRUNCATEremoves all rows from a table but keeps the structure; faster thanDELETE. -
DDL commands auto-commit — you can’t roll them back without explicit transaction control.
-
CREATE TABLEshould include primary key and constraints for best practice. -
You can use
IF EXISTSwithDROPorCREATEto avoid errors. -
CREATE INDEXimproves performance for read-heavy queries. -
Always take a backup before applying DDL changes in production.
-
ALTER TABLEallows adding constraints (PK, FK, CHECK) after table creation. -
Use
sp_helporINFORMATION_SCHEMA.TABLESto check object structure. -
You can generate DDL scripts from SSMS by right-clicking on the object.
-
Constraints like
UNIQUE,NOT NULL,DEFAULTare added via DDL. -
You can use
CREATE SCHEMAto organize tables under logical groups. -
Follow naming conventions when creating objects for consistency and clarity.
- Interview Questions with solutions
🔹 DML (Data Manipulation Language)
-
DML commands are used to modify and retrieve data in existing tables.
-
Main DML commands include
SELECT,INSERT,UPDATE,DELETE, andMERGE. -
SELECTis used to retrieve data from one or more tables or views. -
INSERTis used to add new records into a table. -
You can insert single or multiple rows in one
INSERTstatement. -
UPDATEmodifies existing records based on conditions using theWHEREclause. -
Always use a
WHEREclause inUPDATEto avoid updating all rows. -
DELETEremoves records based on a condition, but the table structure remains. -
Without a
WHEREclause,DELETEremoves all records — use cautiously. -
MERGEcombinesINSERT,UPDATE, andDELETEin a single query (though you prefer not to use it, it’s worth mentioning). -
Transactions can be applied to DML commands (
BEGIN TRAN,COMMIT,ROLLBACK).
Course Curriculum
SQL SERVER
-
InterviewQuestions Part1
00:00 -
InterviewQuestions Part2
00:00 -
InterviewQuestions Part3
00:00 -
InterviewQuestions Part4
00:00 -
DML_DDL and Database Schema Table_introduction
00:00 -
Create_Drop_Databases_Tables_Schema
00:00 -
Create Copy Table
00:00 -
Rename Columns_Delete
00:00 -
Update SQL
00:00 -
Update SQL CustomerTable ShowDiscount
00:00 -
Update Customer Order Quantities
00:00 -
insert Sql Part1
00:00 -
select Into query Project Part2
00:00 -
Project_add Pending orders Part3
00:00 -
import excel UsingSQL Solution Chatgpt_Part4
00:00