1 00:00:00,340 --> 00:00:02,580 Welcome back! While you were gone 2 00:00:02,640 --> 00:00:06,080 Amy just joined our user base with a score of 88. 3 00:00:06,300 --> 00:00:07,600 Perfect. 4 00:00:07,650 --> 00:00:10,800 Now let's learn a few more SQL commands that are useful. 5 00:00:10,800 --> 00:00:18,350 What if I wanted to grab all users with names starting with 'A'. With SQL, 6 00:00:18,410 --> 00:00:20,140 it's super fast and super easy. 7 00:00:21,240 --> 00:00:36,690 We can simply say SELECT all FROM users WHERE name and this is a new one we're learning LIKE. And like 8 00:00:36,690 --> 00:00:38,460 allows us to add a condition. 9 00:00:38,820 --> 00:00:40,980 In our case we can say 'A' 10 00:00:41,310 --> 00:00:46,080 And then the percentage sign which means anything after a. 11 00:00:46,310 --> 00:00:50,880 If I click semi-colon and enter, look at that I get 12 00:00:50,890 --> 00:00:56,470 Andrei and Amy. Let's try this on our GUI as well. 13 00:00:57,500 --> 00:00:58,900 and show you what we can do. 14 00:00:59,110 --> 00:01:01,720 If I go over here, just copy and paste this. 15 00:01:08,820 --> 00:01:18,260 And if I change this to lowercase and run query, Well I don't get anything because it has to be uppercase 16 00:01:18,260 --> 00:01:18,490 right. 17 00:01:18,490 --> 00:01:21,600 We're searching for 'A'. 18 00:01:21,620 --> 00:01:23,140 There you go. 19 00:01:23,350 --> 00:01:30,730 Although with SQL our commands can be lowercase or uppercase when we do searches we want to make sure 20 00:01:30,730 --> 00:01:38,050 that the case matters and that is why mostly when we store information in databases we want to make 21 00:01:38,050 --> 00:01:39,820 sure that there is some consistency. 22 00:01:39,820 --> 00:01:47,520 So when we save this information such as inserting. Maybe in the server we lowercase everything so that 23 00:01:47,520 --> 00:01:49,610 we don't have this issue. 24 00:01:49,650 --> 00:01:52,410 What if I wanted to do all names ending in 'y'. 25 00:01:52,680 --> 00:01:58,110 If I do percentage y run query I get Sally and Amy. Amazing. 26 00:02:00,940 --> 00:02:03,160 Okay what if I want to do something different. 27 00:02:03,730 --> 00:02:07,510 Let's say I want to get everything sorted in order. 28 00:02:07,930 --> 00:02:10,660 Maybe from the highest score to the lowest score. 29 00:02:10,870 --> 00:02:19,750 Well we can select all from users and we can order by the column we want to order by. 30 00:02:19,850 --> 00:02:22,340 In our case it will be the score. 31 00:02:22,510 --> 00:02:28,620 And if we want to do ascending or descending- let's do descending first. 32 00:02:28,720 --> 00:02:30,370 And I spelled descending wrong. 33 00:02:30,370 --> 00:02:32,380 It's DESC. 34 00:02:32,740 --> 00:02:35,000 Press enter and look at that. 35 00:02:35,170 --> 00:02:47,090 I have Sally and John as the top score. If I do ascending ASC, I get low score Andrei, hmm. 36 00:02:47,280 --> 00:02:50,390 I'm not doing too well in this game. 37 00:02:50,440 --> 00:02:52,030 Very cool. 38 00:02:52,030 --> 00:02:53,770 Are you starting to see the power of SQL. 39 00:02:53,770 --> 00:03:00,370 Remember all the looping that we would have had to do if we had usernames. SQL is really 40 00:03:00,370 --> 00:03:03,140 really good at grabbing this information. 41 00:03:03,160 --> 00:03:09,820 You saw how fast this is even if this was hundreds of lines it will be really good at grabbing information, 42 00:03:10,120 --> 00:03:13,340 updating information, maybe ordering it. 43 00:03:13,360 --> 00:03:15,400 It is extremely powerful. 44 00:03:15,400 --> 00:03:22,060 Pretty much since the 1960s it's been just the language of choice for databases because it's so 45 00:03:22,060 --> 00:03:22,560 good. 46 00:03:24,940 --> 00:03:25,570 All right. 47 00:03:25,570 --> 00:03:26,330 Awesome. 48 00:03:26,650 --> 00:03:29,950 We're starting to learn more and more, a few more to go. 49 00:03:29,950 --> 00:03:31,030 I'll see you in the next one. 50 00:03:31,330 --> 00:03:31,990 Bye bye.