Pro tip for anyone who needs to do any database administration: Start every destructive command with BEGIN TRANSACTION, and a ROLLBACK, then type your command in between. Change ROLLBACK to COMMIT once you're sure that your command is ok. Saved my butt a number of times at my job. Happy to be going back to the basics of CS.
@tiagotele1
Ай бұрын
Awesome tip! Thanks!
@edumartim
6 ай бұрын
this professor is a teaching machine, way to go!!!!
@asheaven1st
8 ай бұрын
I love how he teach.. I love how he explain.. Man.. Wish the world have a people like him on every life-aspect
@vikingthedude
8 ай бұрын
Like when i was learning to drive 😔
@enisten
8 ай бұрын
Just beautiful. This was a significant improvement over last year's lecture and I really liked it. Thank you Prof. Malan!
@quickcinemarecap
8 ай бұрын
01:02 Introducing the need for different tools in software programming and the introduction of SQL. 03:11 Google Forms data integrates with Google Sheets for analysis. 07:16 CSV files use quotes for strings with commas to avoid confusion 09:28 Using 'with' in Python to automatically close files. 13:36 Using dictionary to access data instead of numeric indices 15:43 Iterating over a file row by row and incrementing counters based on the content 19:37 Using dictionaries to count occurrences of values in a loop. 21:44 Using dictionaries to track and print values 25:44 Python makes sorting easier with built-in functions and rich libraries 27:46 Python's Counter class simplifies counting and sorting 31:54 SQL allows for interactive and efficient data analysis 33:54 SQL is a declarative language for describing data retrieval and analysis. 37:33 Loading data into SQLite using the command line 39:27 Overview of 'schema' command and selecting columns from a database 43:33 SQL provides various functions like count and distinct to retrieve specific data from tables. 45:29 SQLite distills things into the essence and is widely used. 49:29 Changing the query to get a top list and using aliases 51:29 Adding data to a table using SQL. 55:25 Updating and modifying data in SQL tables. 57:19 Dealing with real-world data sets from large databases 1:00:56 Discussing the design of the spreadsheet implementation. 1:02:39 Eliminating redundancy in data storage 1:06:43 Exploring SQL database normalization 1:08:43 Working with IMDb data and converting to SQLite format 1:12:38 Understanding data types and primary/foreign keys in SQL. 1:14:26 Database design allows for null constraints, unique values, and relationships between tables. 1:18:34 Using SQL to filter and select specific data from multiple tables. 1:20:36 Using SQL to retrieve shows with ratings 6.0 and above. 1:24:21 Joining tables and filtering data based on conditions. 1:26:25 Using SQL and joins to retrieve specific data from tables. 1:30:25 Using SQL to query and reference data in tables. 1:32:23 Using SQL to compose smaller ideas into larger queries for data retrieval. 1:36:11 Using a third table in a many-to-many relationship requires additional steps to retrieve data. 1:38:20 Retrieving person IDs associated with a specific show ID using nested queries 1:42:17 Executing joins with multiple tables in SQL 1:44:36 Different ways to join tables in SQL 1:48:16 Creating indexes in SQL can significantly improve query performance. 1:50:12 Optimizing database performance using indexing 1:54:09 Indexes drastically improve query performance 1:56:19 Resetting and importing data in SQL using SQLite3 and Python 2:00:26 Managing large databases in SQL 2:02:29 Race conditions in large systems 2:06:05 Use transactions to avoid race conditions in SQL. 2:08:09 Single quotes are important in SQLite for strings and comments 2:11:49 Using a library like CS50 handles escaping of user input
@branthebroken2323
7 ай бұрын
Where can i get the Google forms data bro?
@bassycounter
5 ай бұрын
Equal equals equal in sequel is my new favorite tongue twister
@mr_riyajath
7 ай бұрын
Great lecture as always. Thanks CS50 and Prof. David Malan for offering this course to everyone free of cost.
@tingdongliao7036
4 ай бұрын
Great lecture Dr. Malan! Shout out to the supporting team behind too for breaking the educational barriers
@PasirPrism
7 ай бұрын
i went to an SQL course at Oracle 25 years ago... the basics have not changed but this is clearly and well explained and once you master it, it is so much better than python for large data queries . CS50 is really the best.
@charliebitmyfinger7124
7 ай бұрын
I don't think SQL and Python are even comparable.
@skugga7
6 ай бұрын
Python evidently has larger parameters for its usage,. However, in the context of data analysis, they can be comparable. @@charliebitmyfinger7124
@SnPnibba
6 ай бұрын
@@charliebitmyfinger7124 bros out here comparing general purpose full fledged programming language to a query language lmao
@user-ex5pg3oy9c
4 ай бұрын
@@SnPnibba I think HTML is the best programming language!
@mohammeds5007
6 күн бұрын
@@user-ex5pg3oy9c😂😂😂
@0001ssss
8 ай бұрын
Thank you, dr. Malan People like you are really inspirational for CS world.
@activationfunction
8 ай бұрын
Learning SQL is like learning PLC programming. The syntax, theory, workflow, framework... are pretty straightforward. The clusterfeck comes when you start working and realizing that other people's system and setup are ridiculous (and now you are tasked with maintaining or scaling it).
@youMatterItDoesGetBetter
8 ай бұрын
Especially when you get real-world experience with legacy SQL systems. Databases are a f*cking nightmare to work through. It's all archaic non-sense.
@Blackfeet
5 ай бұрын
Yeet.
@youMatterItDoesGetBetter
5 ай бұрын
You should see the DB2 Database at my work. It's a foreign language with SQL sprinkled in.
@Dan-y3f7p
7 ай бұрын
Honestly wish the first part of the lecture opening csv files was included in the last video. Really struggled with this in pset DNA
@sefonefinpsefnpefn4191
7 ай бұрын
true
@CalvinApraku
5 ай бұрын
@@sefonefinpsefnpefn4191 just drag the csv file from your local computer and drop it in the web terminal
@aniiko4138
4 ай бұрын
Same lol
@martinepstein9826
4 ай бұрын
For DNA I just skipped the CSV module and did it with string methods. In particular .split(",")
@Josh-Parkhill
2 күн бұрын
@@martinepstein9826 have you seen the TV show guy 'Smart Guy'
@skblink
3 ай бұрын
This lecture is worth the same as an entire semester of two subjects in my university course
@denysolleik9896
3 ай бұрын
Actually it's completely worthless. You can just have a chatgpt with things you don't understand. I've seen this guy before. He's using way too many words to explain the basics. He's just wasting everyones time trying to promote how prestegious universities are, but everyone is capable of learning. Some people, those who go to a university, need a little pushing. As if it's a mental illness.
@bonadoni762
3 ай бұрын
@@denysolleik9896 Not everyone is as smart as you, brother. I myself am not a fan of learning through ChatGPT or any other AI because it easier for me to learn things through a person's explanation.
@Swegrid
3 ай бұрын
@@denysolleik9896 Get laid dude
@sagarpanwar2845
3 ай бұрын
Then why you are here.
@hedgehog_hey
Ай бұрын
@@denysolleik9896 Why u here ?
@yavor05
6 ай бұрын
Thank you Dr. Malan! A great lecture! It is very noble of you to make such knowledge readily accessible and explained in a captivating way.
@IsisBarrett-Lally
6 ай бұрын
Awesome video! I'm picking up SQL for the first time, and using it as part of my PhD in humanities, and this was perfect to get started, thank you!
@zeeshan.safdar
7 ай бұрын
the best intro of CS50
@semihturku342
2 ай бұрын
I started learning to code with the CS50P series and now I am continuing with CS50X. I watch and learn a lot about coding. Thank you for all of it.
@FigueMonk
2 ай бұрын
I am just like you! We have achieved a lot so far. Congratulations, my friend. See you in CS50W!
@alyonkabenya
8 ай бұрын
getting the information from the first part of the lecture would be super useful for the DNA task 😄
@_kage_
8 ай бұрын
fr
@farhanarahman9375
8 ай бұрын
you mean the problem from week 6?
@sefonefinpsefnpefn4191
7 ай бұрын
@@farhanarahman9375yes
@jjfam777
5 ай бұрын
Exactly what I said 😭😭
@juli.72
5 ай бұрын
Carter covers that on week's 6 section. Don't skip them! The sections from each week are super useful.
@GenZ_01_
Ай бұрын
I finished school but it feels like Ive just started the real one.school of life. Cs50 is ranked right at the top classes.
@ZAVENBBRYN-v9h
Ай бұрын
It was a very satisfying lecture, i especially liked the explanation of index subject, it was a headache for me but Mr. Malan explained it very smoothly which others don't or can not do. Moving to "CS50 SQL - Lecture 0 - Querying" lecture for detailed lessons. Thank you.
@MasterOfYourself
5 ай бұрын
Thank You, David for everything. I really liked the Milk analogy.
@tequila_baby
8 ай бұрын
Learning from a Harvard Teacher from a brazilian favela for free.
@jamespawson6045
7 ай бұрын
Otimo irmao! Boa sorte pelo futuro! Segue assim :-)
@dannyisrael
6 ай бұрын
Niiiice! 🙌
@RashadPrince
5 ай бұрын
This is so awesome to hear. I've been listening to him for free on Apple podcast since 2009 🙏 This is even before he started doing free lectures for everyone and even you could download the videos off the Apple podcast because it was only for Harvard students at that time Now it's for everyone 🎉
@RuanSantos25
4 ай бұрын
lol same! Vamo que vamo irmão 🤙
@giulia6930
3 ай бұрын
Learning from a country that helped make your country a favela for free 🤔
@Polaris_Babylon
8 ай бұрын
An operating systems course by CS50 would be awesome
@ninedaniel246
8 ай бұрын
One of the best teachers EVER!!
@nicholaslydon7089
5 ай бұрын
fantastic lecture as always, thank you!
@chamaocharles
4 ай бұрын
Amazing professor! I was looking for vídeo tutorial to recommend to a friend. This one is perfect.
@ad5772
4 ай бұрын
I got a question, I wonder if you can help, I notice his terminal is so clean when running his programs, do you have an idea how he set it up like that ?
@chamaocharles
4 ай бұрын
@@ad5772 Hi! I never used, but I believe he is executing commands on the command line window on VS Code (press CTRL + J). I usually use Microsoft Studio Managment Studio to access usually SQL Server. He is using SQLite. Ask ChatGPT: "How to execute sql commands on sqlite through vs code terminal window". Here is the answer that it respond it: ``` You can use an extension to open, view, and query SQLite database files directly in **Visual Studio Code**. Here's how: 1. **Install the Extension**: - Click on **Extensions** in the left sidebar (you can also open the Extensions menu by pressing **Ctrl + Shift + X** on Windows or Linux, or **Command + Shift + X** on macOS). - Type **SQLite** and install the extension by **alexcvzz**. - Click on the **Install** button. 2. **Open an SQLite File**: - Once you've installed the extension, you can open an SQLite file by: - Right-clicking on the file in **Explorer**. - Clicking on **Open Database**. - The database will appear as a collapsed menu in the **Explorer** tab. - Click on **SQLite Explorer** to expand the database. - You can then click on a specific table and view its data or run a query. 3. **Running Queries**: - To run a query, create a **.sql** file (e.g., **001.sql**) and type your query. - For example, to select the first 10 rows from a table called **albums**, use: ```sql SELECT * FROM albums LIMIT 10; ``` - To run the query: - Press **Ctrl + Shift + P** on Windows and Linux (or **Command + Shift + P** on macOS). - Type **SQLite run query** and select **SQLite: Run Query**. - A new tab with the query results will open. 4. **Closing the Database**: - When you're done working with the database, you can close it by: - Pressing **Ctrl + Shift + P** on Windows and Linux (or **Command + Shift + P** on macOS). - Typing **SQLite run query** and clicking on **SQLite: Close Database**. Remember to expand the **SQLite Explorer** menu in the left sidebar after opening the database. Happy querying! 😊 For more details, you can refer to [this article](bobbyhadz.com/blog/vscode-view-query-sqlite).¹ Origem: conversa com o Bing, 09/05/2024 (1) How to open, view and query SQLite in VS Code | bobbyhadz. bobbyhadz.com/blog/vscode-view-query-sqlite. (2) Transact-SQL with Visual Studio Code. code.visualstudio.com/docs/languages/tsql. (3) How to run SQL query in visual Studio Code - Stack Overflow. stackoverflow.com/questions/72743136/how-to-run-sql-query-in-visual-studio-code. ```
@sheldonj8204
3 ай бұрын
Guys, if your terminal left aligns the output (unlike in the video), type in sqlite3 prompt: .mode table
@Mo-ip4mm
3 ай бұрын
This is so nice for beginners
@goagirl9767
8 ай бұрын
The opening music is awesome! Came for the class but stayed to listen to the opening music on loop!
@Dante-fk4yi
8 ай бұрын
Your priority = zero
@goagirl9767
8 ай бұрын
Haha so true! You go become a tech tycoon!
@monkeysgone2heaven1
8 ай бұрын
reminded me of the start of a James Bond film
@tanvirhasanmonir1627
6 ай бұрын
As always best lecture 💚
@tuanh9661
8 ай бұрын
1:16:33 I think he meant to say "primary key"
@Bati_
2 ай бұрын
This wonderful vide has made me appreciate the pandas library.
@monitorstolenfromikea
2 ай бұрын
Lol this stuff was complex
@Aman-fz1ew
8 ай бұрын
great lecture ;
@winnieroze
6 ай бұрын
There's a whole new intro now!!
@k16e
7 ай бұрын
So thorough!
@AungThiha-xj2bb
4 ай бұрын
Thank you sir
@100drips
2 ай бұрын
First, i thought SQL is dry and boring. But these problems sets are so much fun. My favorites so far!
@meg.cabellera
6 ай бұрын
I'm grateful that I can understand English, as it allows me to learn from some of the world's leading professors.
@meg.cabellera
6 ай бұрын
我好喜歡他在講解 join 語法時,從長到短來介紹三種語法篇幅 1:42:17 Executing joins with multiple tables in SQL 1:44:36 Different ways to join tables in SQL
@muyanjassenyonga3398
6 ай бұрын
Incredible eloquence at such talking speed ?
@worldwar_two2894
Ай бұрын
i wish i'd like David Malan's content 100000000x🙃
@manifestasisanubari
8 ай бұрын
I'm a noob in SQL but why isn't my sqlite3 interface as neat as this interface with ASCII art? I downloaded it from the original website and I'm using it from Windows cmd. Is this a different version or from a different source? Mine doesn't even display the headers
@davidjmalan
8 ай бұрын
Best to use cs50.dev ! Or on Windows, you can run `sqlite3 -table` !
@manifestasisanubari
8 ай бұрын
@@davidjmalan OMG didn't expect Dr. Malan to reply to this! I thought that maybe others watching would reply. Thank you David! It works 🥰🥰🥰
@MazineZ
7 ай бұрын
A simple solution is to set your mode to table by using the following command `.mode table`
@ceal2137
3 ай бұрын
I'm using Windows, installed sqlite3 on WSL using "sudo apt install sqlite3" some minor differences and I wonder why 1:56:26 when I typed sqlite3 favorites.db, it didn't ask for a confirmation if I want to create a new db 1:59:18 it didn't show alias n above the number 34
@user-kt1iz4vc3x
2 ай бұрын
2:06:00 unfortunately there is a mistake here. placing the two queries in one transaction does not solve the race condition issue. there are several solutions, one of them is to just add (or delete) an entry to the Likes table and each time this happens trigger a function that updates the likes counter, which can be stored as a column of the Post table.
@aleclippe6213
8 ай бұрын
GOAT ACTIVITIES
@aniketbisht2823
5 ай бұрын
NGL, the intro reminds me of GOT intro. EPIC.
@xuenf
3 ай бұрын
The first 30 minutes would have been helpful for the last problem set dna
@mrtn-py9zl
4 ай бұрын
Describing joins as glue should result in the wrong mental model though. The use case Joins have been invented for is a glue-use-case, but it's a quite specific edge case. In actuality, joins are combinatoric operations, so you'd start with explaining cross joins first. All other joins are essentially cross joins within a domain (specified by keys with ON/USING) where you chuck out NULLs selectively depending on the kind of join (e.g. right-side NULLs in LEFT JOIN). Understanding the combinatorics nature of joins is so essential, especially when debugging and a key we thought was unique is not actually unique.
@rishavjain5087
2 ай бұрын
at 32:08, doesn't the count contains "problems", so how david could get an answer for "Scratch"? if that was your question, well scratch was also a problem set..check out here 30:50, just after Hello worlds and Filter
@drx5226
12 күн бұрын
I will be there.
@angelfh3309
4 ай бұрын
first 30 minutes would of be nice to have it before past week 6 problem set...XDD
@bilalbeny4172
8 ай бұрын
thank you so much for this lecture, it was useful 🎯
@domxgun
3 ай бұрын
If they all teached like that I could get behind 100k degrees
@spht9ng
3 ай бұрын
100k degree schools tend to have professors of this caliber yes.
@antonioskokiantonis7051
8 ай бұрын
Without data there is no need for CS!
@aopen130
5 ай бұрын
my favorite joke related to SQL and database XKCD 327 Little Bobby TABLE
@dexvn99
6 ай бұрын
That great!
@magicmaddox
5 ай бұрын
DAVID
@Solao926
Ай бұрын
"Tough crowd" 💀
@bert6774
8 ай бұрын
Show 62614:Zeg 'ns Aaa 😂 That's an old Dutch serie which my parents always watches
@Polaris_Babylon
8 ай бұрын
That's great!
@aopen130
5 ай бұрын
oh david mentioned the bobby table :) at the end
@Russ_Paul
7 ай бұрын
What would be the easiest way to view a relational view (as per in the video with the connected boxes) of the schema for shows.db? Could I export .schema's output into some sort of previewer? edit: The term I was looking for is 'entity-relationship diagram'. As a manual workaround and some help from docs, I converted the sql to postgresSQL and used the dbizzy extention for vscode. It is a bit basic and doesn't show the one-to-one, one-to-many etc symbols, but it's a start.
@sahilghuge5302
3 ай бұрын
48:02 GROUP BY
@ad5772
4 ай бұрын
how did he make his terminal so clean when he run his programs. I have vs code but I have literally failed to setup such an environment. Please be kind I am old
@kennessu4642
3 ай бұрын
ctrl + l if im not wrong
@kennessu4642
3 ай бұрын
ctrl + L
@markkennedy9767
Ай бұрын
That rubber duck is moving
@ankurkumar9757
8 ай бұрын
1:38:44 Batman swoops in
@muhammadnabeedhaider4926
4 ай бұрын
genre to show should be many to many as a genre can have multiple shows
i wonder wh y there are only 2 comments in such a informative video?
@ItzBusinessbhai
8 ай бұрын
Because the matrix has attacked the minds of youth and made them into TIkTOK mind consuming dancing and shit videos and spending their life as a second class citizen as said by Top G !
@centipedekid9824
8 ай бұрын
@@ItzBusinessbhaiOr most people just don't know about this because Harvard doesn't advertise these videos. What makes more sense a psyop like mk ultra or poor advertisement.
@kremznerg
8 ай бұрын
maybe because it was uploaded today?
@MooseGoWoof
8 ай бұрын
@@ItzBusinessbhai Or maybe most people just watch through CS50 Video Player? That makes more sense then the matrix. I don't see much reason for people to go here anyways other than for timestamps.
@shafialanower3820
8 ай бұрын
Wait everything getting uploaded all at once? Nice
@kremznerg
8 ай бұрын
It would be great, if you could upload the favorites.csv file to the Lecture Notes!
@davidjmalan
8 ай бұрын
Done!
@MatheusHenrique-hu1cx
8 ай бұрын
im trying to find this file
@isaacbull-t6g
6 күн бұрын
how can i get the shows database so i can work on the same problem set?
@胡咏琪
Ай бұрын
太棒了
@pinakpaninath4321
7 ай бұрын
what is the logic behind row 1, why all the entries has come in answer?, this is column value right
@sankar_vj_
7 ай бұрын
Hi Team, Can anyone teach about ETL concepts and how it works in real time project.
@konan91
8 ай бұрын
This year's SQL lecture is a lot easier to follow, which is convenient since I was halfway through the old one when it uploaded. I'm not sure about the new introduction though, the music choice is a little strange, I miss the old one
@enisten
8 ай бұрын
Yeah, the same thing happened to me. I was watching the old one on SQL when the new set of lectures was uploaded. And I agree with you on both of your points!
@k23raj2
6 ай бұрын
5-6 months SQL course in college < CS50 2 hours SQL Lecture
@syedzainulabideen4455
9 ай бұрын
1like = 5pushups + 45min workout in 2024
@abhisheknavgan6829
9 ай бұрын
comment = 10?
@Dante-fk4yi
8 ай бұрын
Do the pushups please
@guruoftuks4188
8 ай бұрын
345 push ups hey
@turtlebeast8812
8 ай бұрын
record and upload video of you doing the pushups
@as8kay
8 ай бұрын
Like = 20pushup & squat 🙂
@vikas2__4
Ай бұрын
❤
@sheheryaraltaf1874
2 ай бұрын
1:47:31
@ELFBDS
7 күн бұрын
50:30 "my little baby table" not a technical term 🤣😂 I wonder who is this genius that would think it's a technical term?!
@vashisht1
7 ай бұрын
I know this already. But I still feel that I don't known anything. I am under valuing myself...please help sql interview seems very daunting
@jamespawson6045
7 ай бұрын
Yes, you are undervaluing yourself! Everyone feels like this with new material at some point. Just go back, watch it again, make some notes. Practice what he’a doing while you’re watching in the code editor they provide for free. You can also search out YT videos on the subject too. But don’t worry, we all feel like this at some point, it’s normal.
@ramnaresh_8
7 ай бұрын
what does code means in terminal when $ code favourites.csv is given in command line??
@jamespawson6045
7 ай бұрын
Code opens your file in the code editor
@gathandi5531
8 ай бұрын
Where can i get Show.db file?
@TheGloryMonster
4 күн бұрын
in 47:55 the subtitle should've been "=" equals equality imo.
@OswaldShoo
8 ай бұрын
I'm getting this error: cs50 has no SQL attribute. Can someone help me
@davidjmalan
8 ай бұрын
Are you using cs50.dev or some other programming environment? Do email a screenshot, too, to sysadmins@cs50.harvard.edu!
@OswaldShoo
8 ай бұрын
@davidjmalan already fixed, thanks for being in touch. The error was because I named the file as cs50.py I renamed it and worked 👍
@rayedriasat8079
8 ай бұрын
One question: at 2:06:24 Does python automatically insert the missing semi-colons at the end of sql commands? and also, I guess there shouldn't be semi-colon after db.execute() command as python doesn't need ( ; )
@quang.luu.179
3 ай бұрын
👍👍👍
@johnbeal6592
6 ай бұрын
how can I get the shows.db file?
@isha7372
6 ай бұрын
1 like = one minute of cs50
@gilbertaguidi5998
7 ай бұрын
Porfavor Inclui disponibilize Legendas em português Brasil
@jamespawson6045
7 ай бұрын
Pode fazer voce mesmo e manda pra eles :-)
@bareerasoomro5723
8 ай бұрын
hy atvedx how ro i choose language
@ayaanosaurasrex6582
6 ай бұрын
why didnt anybody laugh at the ending comic. i thought it was pretty funny😭🤣
@RossettiAries-s5w
11 күн бұрын
Rodriguez Eric Martin Sandra Garcia Thomas
@Josh-Parkhill
3 күн бұрын
Ummm this .csv + .DictReader explanation would have been a lot more useful BEFORE the Week 6 DNA problem set🙄
Пікірлер: 216