From the course: Microsoft SQL Server 2022 Essential Training
Unlock this course with a free trial
Join today to access over 24,100 courses taught by industry experts.
Remove a table from the database - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Remove a table from the database
- If you need to remove large number of records from your database, you have two different options. I currently have the script that we started earlier in the chapter that built the Red30Tech ProductCategories Table. Right now we have the create table statement that builds the table structure here at the top, and then we insert a number of records into that table. Let's take a quick peek at what the table currently looks like by coming down to the end and executing select * from ProductCategories. I'll highlight line number 17 and press execute to see those results. So the table currently contains seven rows of data. At the top of my script, I'm going to move everything down a little bit by a pressing enter a couple of times, and then moving back up to line number one. Here, I'll add a line that'll quickly remove every record from the table. This uses the truncate table command, and the table we want to truncate is…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Understand the role of T-SQL2m 40s
-
(Locked)
Use the T-SQL editor6m 49s
-
(Locked)
Create a table with T-SQL6m 33s
-
(Locked)
Solution: Create tables with T-SQL commands3m 46s
-
(Locked)
Add data to a table4m 58s
-
(Locked)
Solution: Add data with T-SQL commands3m 4s
-
(Locked)
Retrieve records with SELECT4m 3s
-
(Locked)
Solution: Query data in a database2m 7s
-
(Locked)
Filter returned results with WHERE3m 12s
-
(Locked)
Sort records2m 54s
-
(Locked)
Solution: Filter and sort data with a query4m 27s
-
(Locked)
Delete records from a table4m 31s
-
(Locked)
Update records in a table2m 3s
-
(Locked)
Solution: Remove and update records in a table6m 11s
-
(Locked)
Joining related tables4m 32s
-
(Locked)
Solution: Query information from related tables5m 33s
-
(Locked)
Remove a table from the database5m 7s
-
-
-
-
-
-