1 00:00:00,090 --> 00:00:03,150 Next up, I'd like to show you my SQL comments. 2 00:00:03,180 --> 00:00:09,000 Now, this is a piece of syntax that technically you could use if you were working in the command line, 3 00:00:09,000 --> 00:00:11,670 but it doesn't really have any benefit. 4 00:00:11,700 --> 00:00:14,150 Most of the time you'll see this is in a file. 5 00:00:14,160 --> 00:00:20,730 So when I say comment, this is a concept that is pretty ubiquitous across all programming languages. 6 00:00:20,910 --> 00:00:24,180 The idea is that I can have some notes in my code. 7 00:00:24,180 --> 00:00:30,150 I can have pieces of code that I don't actually have execute without deleting from my file. 8 00:00:30,180 --> 00:00:35,940 An example would be, let's say I have some piece of syntax like show tables. 9 00:00:35,970 --> 00:00:37,650 Obviously that is my SQL. 10 00:00:37,650 --> 00:00:45,840 We know that it works, but then I want to annotate it up top and say to list all tables in DB. 11 00:00:46,050 --> 00:00:50,790 Well, if I tried to run this file, this is not valid SQL code. 12 00:00:51,000 --> 00:00:54,660 We're going to have a bad time and I could run it in the terminal. 13 00:00:54,660 --> 00:00:56,000 And you see, I get an error. 14 00:00:56,010 --> 00:00:57,330 I try running it over here. 15 00:00:57,330 --> 00:00:58,860 I'll also get an error. 16 00:00:59,310 --> 00:01:00,870 It might be hard to show you. 17 00:01:00,870 --> 00:01:01,290 There it is. 18 00:01:01,320 --> 00:01:02,690 See that red right there? 19 00:01:02,700 --> 00:01:03,780 That is an error. 20 00:01:03,780 --> 00:01:13,020 So to avoid this, if I want to have a note or some piece of code that I turn off, I can use two dashes 21 00:01:13,440 --> 00:01:14,310 and then a space. 22 00:01:14,310 --> 00:01:15,330 I do have to have a space. 23 00:01:15,330 --> 00:01:20,490 Afterwards, you'll see that the editor editor changes color here or I guess it doesn't change color, 24 00:01:20,490 --> 00:01:20,910 does it? 25 00:01:20,910 --> 00:01:22,800 It changes the font weight. 26 00:01:22,800 --> 00:01:25,170 It's not bolded anymore like it is here. 27 00:01:25,380 --> 00:01:29,100 So now if I ran this, we don't get an error. 28 00:01:29,100 --> 00:01:32,970 It actually just runs this code and this is completely ignored. 29 00:01:32,970 --> 00:01:33,930 But it's still there. 30 00:01:34,110 --> 00:01:36,310 It's not deleted, it's just ignored. 31 00:01:36,330 --> 00:01:36,870 Same thing. 32 00:01:36,870 --> 00:01:41,850 If I did it for this line, I don't want this code to run right now, but I want some other stuff to 33 00:01:41,850 --> 00:01:42,330 run. 34 00:01:42,630 --> 00:01:47,610 Well, I can leave it in there with two dashes, assuming that it makes sense to leave it in there. 35 00:01:47,610 --> 00:01:52,530 So you can use this yourself to make notes in your SQL files within the workbench. 36 00:01:52,530 --> 00:01:56,010 I mean, technically you can do it over here in the command line. 37 00:01:56,010 --> 00:01:57,900 I can do like show tables. 38 00:01:57,900 --> 00:02:00,840 If I put those two dashes in front, it doesn't run. 39 00:02:00,840 --> 00:02:04,380 I do the same line without those two dashes and it does run. 40 00:02:05,370 --> 00:02:07,800 But most of the time you're going to do it in a file. 41 00:02:07,830 --> 00:02:09,810 You'll see it in some of my solution code. 42 00:02:09,810 --> 00:02:15,720 One common situation it might come up is if I have some code, which we haven't seen this as this later 43 00:02:15,720 --> 00:02:17,910 in the course, but some code from the future. 44 00:02:17,910 --> 00:02:21,840 And I want to leave it in here, but I want to do some other stuff down here. 45 00:02:22,200 --> 00:02:26,760 I don't want to delete it, but I don't want it to run again because this is making a table. 46 00:02:26,760 --> 00:02:28,770 I don't want to be making a table over and over. 47 00:02:28,770 --> 00:02:36,480 I can highlight this and instead of having to do a hyphen here and then another one here or a comment 48 00:02:36,480 --> 00:02:43,710 rather, I can highlight it in the workbench and then use the shortcut command forward slash on a mac. 49 00:02:43,710 --> 00:02:49,470 I believe it's control forward slash on a PC and then I can undo that again, toggling it with this 50 00:02:49,470 --> 00:02:54,990 same shortcut so that can be nice and you'll see me do that at some points in the course just so that 51 00:02:54,990 --> 00:02:59,280 I can have some code, have a record of it, but not have it run every time I run this file. 52 00:02:59,500 --> 00:03:02,550 Okay, that is it for comments to dashes. 53 00:03:02,670 --> 00:03:04,230 I think the dashes, are they hyphens? 54 00:03:04,230 --> 00:03:05,700 I think hyphen is longer in. 55 00:03:05,820 --> 00:03:06,450 I don't know. 56 00:03:06,450 --> 00:03:08,790 Anyway, those two characters and then a space. 57 00:03:08,790 --> 00:03:11,430 Don't forget the space will make SQL. 58 00:03:11,430 --> 00:03:12,750 Ignore your code.