1
00:00:00,900 --> 00:00:02,220
Okay, great.

2
00:00:02,430 --> 00:00:05,700
Here we'll apply what we learned in the previous lecture.

3
00:00:05,700 --> 00:00:13,590
In an exercise in this simple line, we will create a test table with two columns, numbers and words.

4
00:00:15,050 --> 00:00:18,170
We've written the code on one line with small letters.

5
00:00:18,200 --> 00:00:21,440
Notice how my SQL changed the color of keywords?

6
00:00:22,240 --> 00:00:23,230
Data types.

7
00:00:23,970 --> 00:00:25,020
In numbers.

8
00:00:27,110 --> 00:00:32,420
Now we will not be dealing with an ad hoc software as we are focusing on Workbench.

9
00:00:32,960 --> 00:00:36,240
After having placed the cursor somewhere in this query.

10
00:00:36,260 --> 00:00:42,430
You can press the little brush icon to reformat the script to do the same operation faster.

11
00:00:42,440 --> 00:00:45,020
Remember the control and B shortcut.

12
00:00:46,880 --> 00:00:47,670
Wow.

13
00:00:47,690 --> 00:00:48,650
It worked.

14
00:00:48,950 --> 00:00:54,230
Key words are in capital letters, and the data for each column of the table starts on a new line.

15
00:00:54,560 --> 00:00:55,220
Great.

16
00:00:56,970 --> 00:01:02,700
Imagine you have a further preference regarding the horizontal organization of this code and the alignment

17
00:01:02,700 --> 00:01:04,080
of all data types.

18
00:01:05,470 --> 00:01:11,680
Using the tab button from your keyboard, you can set int and var char to begin at the same horizontal

19
00:01:11,680 --> 00:01:12,340
point.

20
00:01:14,090 --> 00:01:18,740
According to some users, this trick further improves code's readability.

21
00:01:19,520 --> 00:01:22,010
The technical term is called indentation.

22
00:01:22,840 --> 00:01:27,130
We say the column names and their data types were indented to the right.

23
00:01:27,820 --> 00:01:28,870
Amazing.

24
00:01:31,070 --> 00:01:35,390
Another aspect of maintaining good coding style is using comments.

25
00:01:35,570 --> 00:01:38,990
These are lines of text that workbench will not run as code.

26
00:01:38,990 --> 00:01:41,780
They convey a message to someone who reads our code.

27
00:01:42,870 --> 00:01:50,040
Technically in my SQL, you can start a comment by typing a forward slash and a star and close it reciprocally

28
00:01:50,040 --> 00:01:52,200
with a star in a forward slash.

29
00:01:53,650 --> 00:01:56,560
This approach is used mainly for large comments.

30
00:02:03,320 --> 00:02:04,760
For one line comments.

31
00:02:04,760 --> 00:02:08,389
You can use either two dashes or one or more hash signs.

32
00:02:13,380 --> 00:02:20,250
In addition to differentiate them from Mir code, my SQL workbench marks all comments in grey.

33
00:02:20,580 --> 00:02:21,870
Fantastic.

34
00:02:22,410 --> 00:02:27,690
Finally, I would like to elaborate on the lightning symbol, which helps you execute your code.

35
00:02:29,220 --> 00:02:35,340
Let's start from the fact that your code is separated into blocks as marked by the semicolon separator.

36
00:02:38,270 --> 00:02:38,990
Okay.

37
00:02:40,970 --> 00:02:48,020
So if you place your cursor on one block and then press the lightning icon or the control shift, enter

38
00:02:48,020 --> 00:02:48,980
combination.

39
00:02:50,690 --> 00:02:54,290
SCL will run the selected and all remaining queries.

40
00:02:54,650 --> 00:03:01,490
That's why if I click on from an execute the code this way I will see the output from the Select Statement

41
00:03:01,490 --> 00:03:03,290
and we'll drop the test table.

42
00:03:07,050 --> 00:03:12,760
If you would like to run just the statement under the cursor, you must press the adjacent icon where

43
00:03:12,760 --> 00:03:15,030
a lightning and a cursor are depicted.

44
00:03:15,360 --> 00:03:19,560
The corresponding keyboard combination is control and enter.

45
00:03:21,720 --> 00:03:27,540
I can promise you will not stop using this keyboard combination until the very end of the course, as

46
00:03:27,540 --> 00:03:33,750
it allows you to see the output of a certain query quickly without having to run the entire SQL code.

47
00:03:34,440 --> 00:03:36,990
Well, I hope you like these two lectures.

48
00:03:37,530 --> 00:03:42,690
They were aimed at making you aware of the notion of clean coding and coding and good style.

49
00:03:42,930 --> 00:03:48,630
We consider these tools essential for good professional coding, so we would be happy if you can since

50
00:03:48,630 --> 00:03:51,840
you started building good coding style habits.

51
00:03:52,200 --> 00:03:55,260
Great enough about theory and basics.

52
00:03:55,260 --> 00:04:02,010
In our next video, we will show you how to load the employees database, which is rather big and will

53
00:04:02,010 --> 00:04:05,040
serve us for the rest of the lectures in this course.

54
00:04:05,220 --> 00:04:09,090
We will start our data manipulation lessons right after that.

55
00:04:09,120 --> 00:04:10,590
Thank you for watching.


