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.
Solution: Add data with T-SQL commands - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Solution: Add data with T-SQL commands
(techno upbeat music) - [Instructor] For this challenge, we were given a table of menu items for a hamburger restaurant, and we're asked by the head chef to add in a couple of new items, so that our guests have some additional selections to choose from. I'm going to start by just running the SELECT statement that we're given, to see everything that's in the RestaurantMenu to start with. So this table has four columns. The ITEMID, we're told is an auto-incrementing ID number, so we're not going to fill this in. The database will add these ID numbers for us as we add in our additional items. And then we have an ITEMNAME, CATEGORY, and PRICE column, and there's currently two different selections on the menu right now. So we're just going to add in three additional items to this menu, and we can do that with an INSERT statement. So we'll say INSERT INTO the RestaurantMenu table. And, because we're not going to fill in values for all four columns, I do need to specify the columns that I am…
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
-
-
-
-
-
-