Intermediate SQL Tutorial | Updating/Deleting Data
Skills:
SQL Analytics90%
Key Takeaways
This video tutorial covers intermediate SQL topics, including updating and deleting data, with a focus on MySQL and data analytics.
Full Transcript
what is going on everybody my name is Alex Freiburg and today we're gonna be looking at updating and deleting data in a table now what's the difference between inserting data into a table and updating data insert into is going to create a new row in your table while updating is gonna alter a pre-existing row while the leading is going to specify what rows you want to remove from your table so let's get going with the updating so down here Holly flax does not have an employee ID age or gender now we want to update this table to give her that information so let's do update now we need to specify what table we're gonna be hitting off of so let's do sequel tutorial TVO dot employee demographics so now we're gonna use something called set and set is gonna specify what column and what value you actually want to insert into that cell so let's set her employee ID equal to and it's going to be 1012 and we have to specify which one to do this to because if we ran just this is gonna set every single employee ID to one thousand twelve because we haven't specified that we only want Holly flax is row to be updated so now we have to specify where first-name is equal to Holly and lastname is equal to flex so now let's run this and see what we get so one row has been affected let's see what we got and there we go as you can see the employee ID was updated exactly how we specified it right here so we also want to update age and gender and let's do that in the same query so let's set the age equal to thirty one and instead of using and we actually need to use a comma so let's say age equal to thirty one comma gender is going to be equal to female and let's run this and see we get there you go now let's look at our table and as you can see it was updated to 31 and female so very easy very easy to specify what you want oftentimes tables like this will have a unique key like employee ID is our unique key in this table so I could easily just say where the employee ID is equal to and then you know 1012 so it's an easy way to specify what employee you're trying to update so now let's look at the delete statement the delete statement is going to remove an entire row from our table so let's do delete and we actually need to say from and we have to specify what table we want to be removing this information from so let's do sequel tutorial dot DV dot employee demographics and now we need to specify what row we want to remove so let's do where employee ID is equal to and let's choose a completely random employee ID 1005 so let's run this and see what happens so one rows affected let's look at our table and as you can see one thousand five is now gone now you have to be very careful when you use the delete statement because once you run it you cannot get that data back there's no way to reverse a delete statement so if I had gotten rid of this wear statement and I ran this it would delete everything from the entire table and you could not get that data back so a little trick that I use before I actually run a delete statement is I make it a select statement because you're gonna select everything where the employee ID is equal to let's just do in that form and now when you run this you were gonna see exactly what you will be deleting and now we know that Angela Martin that entire row is gonna be gone if I haven't done that and I just went like this and I wrote delete and I only had this running I would not know that this information is gonna be the only one that's gone maybe I made a mistake down here maybe I accidentally put something in - that wasn't supposed to be in there and now I'm deleting much more than I thought I was actually gonna delete so using the selects naming can be a very good safeguard against so then to lead to leading data that you do not want to delete so that is update and delete thank you guys so much for watching I really appreciate it if you liked this video be sure to subscribe below and I'll see you in the next video
Original Description
Take my Full MySQL Course Here: https://bit.ly/3tqOipr
In today's Intermediate SQL lesson we walk through Updating/Deleting Data.
All Topics Covered: Joins, Unions, Case Statements, Updating/Deleting Data, Partition By, Data Types, Aliasing, Views, Having Clause, GetDate(), Primary vs Foreign Key
____________________________________________
SUBSCRIBE!
Do you want to become a Data Analyst? That's what this channel is all about! My goal is to help you learn everything you need in order to start your career or even switch your career into Data Analytics. Be sure to subscribe to not miss out on any content!
____________________________________________
Resources:
Coursera Courses:
Google Data Analyst Certification: https://coursera.pxf.io/5bBd62
Data Analysis with Python - https://coursera.pxf.io/BXY3Wy
IBM Data Analysis Specialization - https://coursera.pxf.io/AoYOdR
Tableau Data Visualization - https://coursera.pxf.io/MXYqaN
Udemy Courses:
Python for Data Analysis and Visualization- https://bit.ly/3hhX4LX
Statistics for Data Science - https://bit.ly/37jqDbq
SQL for Data Analysts (SSMS) - https://bit.ly/3fkqEij
Tableau A-Z - http://bit.ly/385lYvN
*Please note I may earn a small commission for any purchase through these links - Thanks for supporting the channel!*
____________________________________________
Websites:
GitHub: https://github.com/AlexTheAnalyst
____________________________________________
*All opinions or statements in this video are my own and do not reflect the opinion of the company I work for or have ever worked for*
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Alex The Analyst · Alex The Analyst · 21 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
▶
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Top 3 Data Analyst Skills in 2020
Alex The Analyst
Truth About Big Companies | Told by a Fortune 500 Data Analyst
Alex The Analyst
Data Analyst Salary | 100k with No Experience
Alex The Analyst
Working at a Big Company Vs Small Company | Told by a Fortune 500 Data Analyst
Alex The Analyst
Data Analyst Resume | Reviewing My Resume! | Fortune 500 Data Analyst
Alex The Analyst
Data Analyst Resume | Complete Guide To Creating A Data Analyst Resume | Tips + Templates + Examples
Alex The Analyst
Switching Careers to Become a Data Analyst | How I Made the Switch
Alex The Analyst
Working With a Recruiter to Land Your First Job as a Data Analyst | LinkedIn Recruiters
Alex The Analyst
Data Analyst Salary in 2020
Alex The Analyst
Data Analyst Resume | Reviewing YOUR Data Analyst Resumes!
Alex The Analyst
Data Analyst Fact Check | 84k Average Starting Salary?? | The Career Force 2020 Data Analyst Salary
Alex The Analyst
SQL Basics Tutorial For Beginners | Installing SQL Server Management Studio and Create Tables | 1/4
Alex The Analyst
SQL Basics Tutorial For Beginners | Select + From Statements | 2/4
Alex The Analyst
SQL Basics Tutorial For Beginners | Where Statement | 3/4
Alex The Analyst
SQL Basics Tutorial For Beginners | Group By + Order By Statements | 4/4
Alex The Analyst
Day in the Life of a Data Analyst | Fortune 500 Edition
Alex The Analyst
Intermediate SQL Tutorial | Inner/Outer Joins | Use Cases
Alex The Analyst
Intermediate SQL Tutorial | Unions | Union Operator
Alex The Analyst
Intermediate SQL Tutorial | Case Statement | Use Cases
Alex The Analyst
Intermediate SQL Tutorial | Having Clause
Alex The Analyst
Intermediate SQL Tutorial | Updating/Deleting Data
Alex The Analyst
Day in the Life of a Data Analyst | Fortune 500 Edition (During Quarantine)
Alex The Analyst
Data Analyst Interview Questions | Phone + In-Person Interview Questions
Alex The Analyst
SQL Interview Questions and Answers for Beginners | Data Analyst Interview Questions
Alex The Analyst
Data Analyst Interview Questions | What To Say vs What NOT To Say
Alex The Analyst
Data Analyst Interviews | Salary Negotiation
Alex The Analyst
Data Analyst Q&A LIVE
Alex The Analyst
Intermediate SQL Tutorial | Aliasing
Alex The Analyst
Data Scientist vs Data Analyst | Which Is Right For You?
Alex The Analyst
Best Online Courses for Data Analysts
Alex The Analyst
Best Free Online Courses for Data Analysts
Alex The Analyst
Data Analyst vs Business Analyst | Which Is Right For You?
Alex The Analyst
Scraping Data Off Twitter Using Python | Twitterscraper + NLP + Data Visualization
Alex The Analyst
Data Analyst Question and Answer | Answering Your YouTube Questions
Alex The Analyst
What Does a Data Analyst Actually Do?
Alex The Analyst
Data Analyst Bootcamps | Are They Worth It?
Alex The Analyst
Top 5 Reasons Not to Become a Data Analyst
Alex The Analyst
Data Analyst Career Path | How to Become a Data Analyst + What to Do Next
Alex The Analyst
Live Data Analyst Q&A #3
Alex The Analyst
Top 5 Reasons Not to Lie on Your Resume
Alex The Analyst
The Hiring Process from an Interviewer's Perspective | Alex The Analyst Show | Episode 1
Alex The Analyst
Top 5 Reasons Data Analytics is a Good Career Choice
Alex The Analyst
How I Changed Careers to Become a Data Analyst | Alex The Analyst Show | Episode 2
Alex The Analyst
Top 5 Reasons You'll Be a Good Data Analyst
Alex The Analyst
Self Taught vs Boot Camp vs Degree | Alex The Analyst Show | Episode 3
Alex The Analyst
Covid and the Data Analyst Job Market | Alex The Analyst Show | Episode 4
Alex The Analyst
Data Analyst Expectations vs Reality
Alex The Analyst
Imposter Syndrome in Tech | Alex The Analyst Show | Episode 5
Alex The Analyst
Top 10 Coursera Courses for Data Analysts
Alex The Analyst
Working at a Startup vs Fortune 500 Company | Alex The Analyst Show | Episode 6
Alex The Analyst
Data Analyst Certifications | Are They Worth It? | Alex The Analyst Show | Episode 7
Alex The Analyst
Top 10 Udemy Courses for Data Analysts
Alex The Analyst
Asking My Wife Your Questions About Me | Alex The Analyst Show | Episode 8
Alex The Analyst
Data Analyst Q&A LIVE #4
Alex The Analyst
Data Analyst Skills Path | What Skills You NEED to Know
Alex The Analyst
What is Analytics Consulting? With John Ariansen | Alex The Analyst Show | Episode 9
Alex The Analyst
Solving LeetCode SQL Interview Questions | Part 1/3
Alex The Analyst
What is No Code Analytics? | Alex The Analyst Show | Episode 10
Alex The Analyst
Top 3 Tips on Using LinkedIn to Land a Job
Alex The Analyst
Completely Unrealistic Jobs on LinkedIn | Alex The Analyst Show | Episode 11
Alex The Analyst
More on: SQL Analytics
View skill →Related AI Lessons
🎓
Tutor Explanation
DeepCamp AI