-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathtutorial.json
3676 lines (3676 loc) · 148 KB
/
tutorial.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"id": "freeCodeCamp/learn-sql-by-building-a-student-database-part-2:v1.0.0",
"version": "2.0.0",
"summary": {
"title": "Learn SQL by Building a Student Database: Part 2",
"description": "> Welcome to Part 2 of the Build a Student Database Lessons!"
},
"config": {
"setup": {
"commands": [
"./.freeCodeCamp/reset.sh",
"cd .freeCodeCamp && npm install"
],
"commits": [
"8c97b76e08f0815374a74ce6d8cfec2add16e489"
]
},
"testRunner": {
"command": "npm run programmatic-test",
"args": {
"tap": "--reporter=mocha-tap-reporter"
},
"directory": ".freeCodeCamp"
},
"repo": {
"uri": "https://github.com/freeCodeCamp/learn-sql-by-building-a-student-database-part-2",
"branch": "v2.0.0"
},
"continue": {
"commands": [
"./.freeCodeCamp/reset.sh"
]
},
"reset": {
"commands": [
"./.freeCodeCamp/reset.sh"
]
},
"dependencies": [
{
"name": "node",
"version": ">=10"
}
],
"webhook": {
"url": "https://api.freecodecamp.org/coderoad-challenge-completed",
"events": {
"init": false,
"reset": false,
"step_complete": false,
"level_complete": false,
"tutorial_complete": true
}
}
},
"levels": [
{
"id": "10",
"title": "Start the Terminal",
"summary": "",
"content": "",
"steps": [
{
"id": "10.1",
"setup": {
"watchers": [
"../.bash_history"
],
"commits": [
"d58fba7fe4cfc8c3925b92610674e40e9deb4456"
]
},
"content": "**The first thing you need to do is start the terminal.** Do that by clicking the \"hamburger\" menu at the top left of the screen, going to the \"terminal\" section, and clicking \"new terminal\". Once you open a new one, type `echo hello SQL` into the terminal and press enter.",
"hints": [
"Capitalization matters",
"If the tests don't run automatically, try typing `exit` into the terminal and redoing the instructions"
]
}
]
},
{
"id": "20",
"title": "psql login",
"summary": "",
"content": "",
"steps": [
{
"id": "20.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"87aed7f9c4db049274e851969ac0b0149a341a56"
]
},
"content": "In Part 1 of this tutorial, you created a `students` database and then a script to insert information about your computer science students into it. Log into the psql interactive terminal with `psql --username=freecodecamp --dbname=postgres` to see if it's here.",
"hints": [
"Type `psql --username=freecodecamp --dbname=postgres` into the terminal and press enter"
]
}
]
},
{
"id": "30",
"title": "\\l",
"summary": "",
"content": "",
"steps": [
{
"id": "30.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"1c9174933ba5611d8f1c905eca81d72ca9d314ea"
]
},
"content": "List the databases.",
"hints": [
"Use the **l**ist shortcut command",
"It's the `\\l` command",
"Type `\\l` into the psql prompt and press enter",
"Enter `psql --username=freecodecamp --dbname=postgres` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "40",
"title": "rebuild database",
"summary": "",
"content": "",
"steps": [
{
"id": "40.1",
"setup": {
"watchers": [
"../.bash_history"
],
"commits": [
"61098ff47c802c519064ebc73580b5f72bc32f29"
]
},
"content": "Your database isn't here. You can use the `.sql` file you created at the end of Part 1 to rebuild it. I recommend \"splitting\" the terminal. You can do that by clicking the \"hamburger\" menu at the top left of the window, going to the \"Terminal\" menu, and clicking \"Split Terminal\". Once you've done that, enter `psql -U postgres < students.sql` in it to rebuild the database.",
"hints": [
"Enter the suggested command in the terminal",
"Make sure you are in the `project` folder first"
]
}
]
},
{
"id": "50",
"title": "\\l",
"summary": "",
"content": "",
"steps": [
{
"id": "50.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"39be444188d17f5ad4c07db9cb6920f85d15455a"
]
},
"content": "A lot of stuff happened in the terminal. That looks promising. In the psql prompt, view the databases again.",
"hints": [
"Use the **l**ist shortcut command",
"It's the `\\l` command",
"Type `\\l` into the psql prompt and press enter",
"Enter `psql --username=freecodecamp --dbname=postgres` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "60",
"title": "\\c students",
"summary": "",
"content": "",
"steps": [
{
"id": "60.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"add4581b538ee98c0d253d52507259efaae8965e"
]
},
"content": "There's your `students` database. Connect to it.",
"hints": [
"Use the **c**onnect shortcut command with the database name after it",
"It's the `\\c` command",
"Here's an example `\\c <database>`",
"Type `\\c students` into the psql prompt and press enter",
"Enter `psql --username=freecodecamp --dbname=postgres` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "70",
"title": "\\d",
"summary": "",
"content": "",
"steps": [
{
"id": "70.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"3abf2cdf207398a1b9dcc3010edd2f716fe0026b"
]
},
"content": "Now that you're connected. Display the tables and relations that are here to see if it's all correct.",
"hints": [
"Use the **d**isplay shortcut command",
"It's the `\\d` command",
"Type `\\d` into the psql prompt and press enter",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "80",
"title": "\\d students",
"summary": "",
"content": "",
"steps": [
{
"id": "80.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"d0de96fc6355cbc8d15edd032af23bc346c77288"
]
},
"content": "That all looks right. View the details of the `students` table to make sure the stucture is right.",
"hints": [
"Use the **d**isplay shortcut command with the table name after it",
"It's the `\\d` command",
"Here's an example: `\\d <table_name>`",
"Type `\\d students` into the psql prompt and press enter",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "90",
"title": "select * from students",
"summary": "",
"content": "",
"steps": [
{
"id": "90.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"91b44c64c738a98b0d35c9ba5dfb89088d719dd1"
]
},
"content": "Looks good. Make sure all the data is in the table, as well.",
"hints": [
"View all the data in the `students` table",
"Use the `SELECT` and `FROM` keywords with `*` to view all the columns",
"Here's an example: `SELECT <columns> FROM <table_name>`;",
"Type `SELECT * FROM students;` into the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1220",
"title": "touch student_info.sh",
"summary": "",
"content": "",
"steps": [
{
"id": "1220.1",
"setup": {
"watchers": [
"../.bash_history"
],
"commits": [
"32a7c6b5af435987b06e52dfd613b591d3b8e903"
]
},
"content": "The data is all there. You should take a look at the details of the other tables and the data in them to make sure they look good. When you are done, use `touch` in the bash terminal to create `student_info.sh`. You are going to make a script to print info about your students.",
"hints": [
"Here's an example: `touch <filename>`",
"Enter `touch student_info.sh` in the terminal",
"The bash terminal, not the psql one",
"Make sure you are in the `project` folder first"
]
}
]
},
{
"id": "1230",
"title": "chmod +x student_info.sh",
"summary": "",
"content": "",
"steps": [
{
"id": "1230.1",
"setup": {
"watchers": [
"../.bash_history"
],
"commits": [
"2f94512d4b15118be549c952e441cce4f7ad4af0"
]
},
"content": "Give your new file executable permissions.",
"hints": [
"It's the `chmod` command with the `+x` flag",
"Here's an example: `chmod +x <filename>`",
"Type `chmod +x student_info.sh` in the terminal and press enter"
]
}
]
},
{
"id": "1240",
"title": "Add shebang",
"summary": "",
"content": "",
"steps": [
{
"id": "1240.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"d727d0c372ac93361c88f266c0a7f8cfab92bbb8"
]
},
"content": "Add a shebang that uses bash at the top of your new script.",
"hints": [
"The shebang you want is `#!/bin/bash`",
"Add `#!/bin/bash` to your `student_info.sh` file"
]
}
]
},
{
"id": "1250",
"title": "Add comment",
"summary": "",
"content": "",
"steps": [
{
"id": "1250.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"566fdc412fd81c8f4af5ca4008844f5deb572b93"
]
},
"content": "Below the shebang, add a comment that says `Info about my computer science students from students database`.",
"hints": [
"Make sure it's a single line comment",
"A comment look like this: `# <comment>`",
"Add `# Info about my computer science students from students database` below the \"shebang\" in your `student_info.sh` file"
]
}
]
},
{
"id": "1260",
"title": "Add echo title",
"summary": "",
"content": "",
"steps": [
{
"id": "1260.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"c1a7be92be59d0c98e457073797d03b407d9f763"
]
},
"content": "In the new script, use `echo` to print `~~ My Computer Science Students ~~`. Use the `-e` flag with it to put a new line at the beginning and end of the text.",
"hints": [
"The new line character is `\\n`",
"Here's an example: `echo -e \"\\n<text>\\n\"`",
"Add `echo -e \"\\n~~ My Computer Science Students ~~\\n\"` below the comment in your `student_info.sh` file"
]
}
]
},
{
"id": "1265",
"title": "./student_info.sh",
"summary": "",
"content": "",
"steps": [
{
"id": "1265.1",
"setup": {
"watchers": [
"../.bash_history"
],
"commits": [
"d499acc38c2945bdc276d50154fa723abbbf70d1"
]
},
"content": "Run the script to make sure it's working.",
"hints": [
"Run your `student_info.sh` script by executing it",
"Type `./student_info.sh` in the terminal and press enter",
"Make sure you are in the `project` folder first"
]
}
]
},
{
"id": "1270",
"title": "Add PSQL Variable",
"summary": "",
"content": "",
"steps": [
{
"id": "1270.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"d7cc52e8df2f8631e4b427261e9853f8cb480890"
]
},
"content": "You will want to query the database again to get info about the students to display. Add the same `PSQL` variable you use in your `insert_data.sh` script. It looked like this: `PSQL=\"psql -X --username=freecodecamp --dbname=students --no-align --tuples-only -c\"`",
"hints": [
"Add the suggested variable at the bottom of the `student_info.sh` file"
]
}
]
},
{
"id": "1280",
"title": "Add echo students with 4.0",
"summary": "",
"content": "",
"steps": [
{
"id": "1280.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"bea5773f9848193dd2c0a638f6ca5dcce20beeaf"
]
},
"content": "Below the PSQL variable you just added, use `echo` to print `First name, last name, and GPA of students with a 4.0 GPA:`. Use the `-e` flag to put a new line at the beginning of the sentence.",
"hints": [
"The new line character is `\\n`",
"Here's an example of the command: `echo -e \"\\n<text_here>\"`",
"At the bottom of the `student_info.sh` file, add this:\n```sh\necho -e \"\\nFirst name, last name, and GPA of students with a 4.0 GPA:\"\n```"
]
}
]
},
{
"id": "1290",
"title": "psql SELECT * FROM students",
"summary": "",
"content": "",
"steps": [
{
"id": "1290.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"21c135b7d5959c011f5afd22d583ecdff9fe90e2"
]
},
"content": "You will want to print what that sentence is asking for. You should know how to make that query, but lets practice a little first. `SQL` stands for \"Structured Query Language\". It's the language you have been using to manage your relational databases. In the psql prompt, view all the data in the students table like you have done many times.",
"hints": [
"Use the `SELECT` and `FROM` keywords with `*` to view all the data",
"Enter `SELECT * FROM students;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1300",
"title": "psql SELECT first_name",
"summary": "",
"content": "",
"steps": [
{
"id": "1300.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"0cc12d8eac48539f30b5568bff60ac1f73d57bbe"
]
},
"content": "You should look at the column titles that were returned. The `*` gets all columns in a table with your query. You can return specific columns by putting the column name in the query instead of `*`. In the psql prompt, view just the `first_name` column from the `students` table.",
"hints": [
"Use the `SELECT` and `FROM` keywords",
"Here's an example: `SELECT <column_name> FROM <table_name>;`",
"Enter `SELECT first_name FROM students;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1310",
"title": "psql SELECT first_name, last_name, gpa",
"summary": "",
"content": "",
"steps": [
{
"id": "1310.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"458b27892ccc9dbcd7dfd2dd7f5979e70e253c0f"
]
},
"content": "Just the `first_name` column was returned that time. You can specify as many columns you want returned by separating them with commas. View the `first_name`, `last_name` and `gpa` columns from the `students` table.",
"hints": [
"Use the `SELECT` and `FROM` keywords",
"Here's an example: `SELECT <column_1>, <column_2>, FROM <table_name>;`",
"Enter `SELECT first_name, last_name, gpa FROM students;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already",
"Don't filter any rows"
]
}
]
},
{
"id": "1320",
"title": "psql SELECT WHERE gpa < 2.5",
"summary": "",
"content": "",
"steps": [
{
"id": "1320.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"cbada490dc7105329db5f9405d27c97ea9c93af9"
]
},
"content": "You can return only rows you want by adding `WHERE <condition>` to your query. A condition can consist of a column, an operator, and a value. Use one of these to view the same columns as before but only rows `WHERE gpa < 2.5`.",
"hints": [
"Here's an example: `SELECT <columns> FROM <table_name> WHERE <condition>;`",
"The previous command you used was `SELECT first_name, last_name, gpa FROM students;`",
"The condition you want is `WHERE gpa < 2.5`",
"Enter `SELECT first_name, last_name, gpa FROM students WHERE gpa < 2.5;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1330",
"title": "psql SELECT WHERE gpa >= 3.8",
"summary": "",
"content": "",
"steps": [
{
"id": "1330.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"bb85dfdd68291e4525eca45b9dd5cb4e199e06e5"
]
},
"content": "The `<` only return rows where the `gpa` column was less than `2.5`. Some other operators are: `<`, `>`, `<=`, `>=`. View the same columns, but only rows for students with a `gpa` greater than or equal to `3.8`.",
"hints": [
"The greater than or equal to operator is `>=`",
"Here's an example: `SELECT <columns> FROM <table_name> WHERE <condition>;`",
"The previous command you used was `SELECT first_name, last_name, gpa FROM students WHERE gpa < 2.5;`",
"The condition you want here is `WHERE gpa >= 3.8`",
"Enter `SELECT first_name, last_name, gpa FROM students WHERE gpa >= 3.8;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1340",
"title": "psql SELECT WHERE != 4.0",
"summary": "",
"content": "",
"steps": [
{
"id": "1340.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"31ce05419d9acd916ebdcaeffa25f8eee8117ef0"
]
},
"content": "That only returned students with a GPA of 3.8 or better. There's equal (`=`) and not equal (`!=`) operators as well. View the same columns for students that don't have a 4.0 gpa.",
"hints": [
"Use the not equal (`!=`) operator",
"The previous command you used was `SELECT first_name, last_name, gpa FROM students WHERE gpa >= 3.8;`",
"The condition you want here is `WHERE gpa != 4.0`",
"Enter `SELECT first_name, last_name, gpa FROM students WHERE gpa != 4.0;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1360",
"title": "Add echo query result",
"summary": "",
"content": "",
"steps": [
{
"id": "1360.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"772044249720a9edf11f9442047bc74d6567bd39"
]
},
"content": "The right query will get you only the data you are looking for. Back in your `student_info.sh` file, add an `echo` command to the bottom that prints what the sentence above it asks for. Place double quotes around it like this: `echo \"$($PSQL \"<query_here>\")\"`. This will make it so the output isn't all on one line.",
"hints": [
"Add `echo \"$($PSQL \"<query_here>\")\"` to the bottom of the `student_info.sh` file, except with the correct query in it",
"You previously used, `SELECT first_name, last_name, gpa FROM students WHERE gpa != 4.0;` in the psql prompt",
"The condition you want here is `WHERE gpa = 4.0`",
"Practice the query in the psql prompt to make sure it's getting what you want",
"If you run your script, the last echo statement should print:\n```sh\nCasares|Hijo|4.0\nVanya|Hassanah|4.0\nDejon|Howell|4.0\n```",
"Add `echo \"$($PSQL \"SELECT first_name, last_name, gpa FROM students WHERE gpa = 4.0\")\"` to the bottom of the `student_info.sh` file"
]
}
]
},
{
"id": "1370",
"title": "./student_info.sh",
"summary": "",
"content": "",
"steps": [
{
"id": "1370.1",
"setup": {
"watchers": [
"../.bash_history"
],
"commits": [
"f149e55e59aa91db945f99cc0afd8da4bbede702"
]
},
"content": "Run the script to see your students with the highest GPA's.",
"hints": [
"Run your `student_info.sh` script by executing it",
"Type `./student_info.sh` in the terminal and press enter",
"Make sure you are in the `project` folder first"
]
}
]
},
{
"id": "1380",
"title": "Add echo courses before D",
"summary": "",
"content": "",
"steps": [
{
"id": "1380.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"14283e01326a9cc3416922c8f812a9abb7817bfb"
]
},
"content": "Add another `echo` statement at the bottom of the script. Make it print `All course names whose first letter is before 'D' in the alphabet:`. Put a new line in front of it like the first sentence.",
"hints": [
"Use `echo` with the `-e` flag and a new line character",
"The new line character is `\\n`",
"Here's an example of the command: `echo -e \"\\n<text_here>\"`",
"At the bottom of the `student_info.sh` file, add this:\n```sh\necho -e \"\\nAll course names whose first letter is before 'D' in the alphabet:\"\n```"
]
}
]
},
{
"id": "1390",
"title": "psql SELECT * FROM majors",
"summary": "",
"content": "",
"steps": [
{
"id": "1390.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"768b1db7dae189ea80a55d287f19713ddcc1a5d0"
]
},
"content": "Practice first. In the psql prompt, view all the data in the `majors` table.",
"hints": [
"Use the `SELECT` and `FROM` keywords with `*` to view all the data",
"Enter `SELECT * FROM majors;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1400",
"title": "psql SELECT WHERE major = Game Design",
"summary": "",
"content": "",
"steps": [
{
"id": "1400.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"dcbd4b34de107197df95f55b8028879a0e633dbc"
]
},
"content": "The operators you used with numbers in the last section can be used on text as well. Use the `=` to view all majors named `Game Design`. Don't forget that You need single quotes around text values.",
"hints": [
"Use the `SELECT`, `FROM`, and `WHERE` keywords with `*` to view the suggested rows",
"Here's an example: `SELECT <columns> FROM <table> WHERE <condition>;`",
"The condition you want is `major = 'Game Design'`",
"Enter `SELECT * FROM majors WHERE major = 'Game Design';` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1410",
"title": "psql SELECT WHERE major != Game Design",
"summary": "",
"content": "",
"steps": [
{
"id": "1410.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"366cc9376cc4c5ae6d48cb30e85b61693ab3f15c"
]
},
"content": "Next, view all the rows not equal to `Game Design`.",
"hints": [
"The not equal operator is `!=`",
"Use the `SELECT`, `FROM`, and `WHERE` keywords with `*` to view the suggested rows",
"Here's an example: `SELECT <columns> FROM <table> WHERE <condition>;`",
"The condition you want is `major != 'Game Design'`",
"Enter `SELECT * FROM majors WHERE major != 'Game Design';` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1420",
"title": "psql SELECT WHERE major > Game Design",
"summary": "",
"content": "",
"steps": [
{
"id": "1420.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"b53605fb63de0e23e2d2db1186bb32649de7781f"
]
},
"content": "Use the greater than operator to see majors that come after it alphabetically.",
"hints": [
"The greater than operator is `>`",
"You want to see what rows are `> 'Game Design'`",
"Use the `SELECT`, `FROM`, and `WHERE` keywords with `*` to view the suggested rows",
"Here's an example: `SELECT <columns> FROM <table> WHERE <condition>;`",
"The condition you want is `major > 'Game Design'`",
"Enter `SELECT * FROM majors WHERE major > 'Game Design';` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1430",
"title": "psql SELECT WHERE major >= Game Design",
"summary": "",
"content": "",
"steps": [
{
"id": "1430.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"89e0865d5a69dd8e08adc11e914c02b01dc5e91f"
]
},
"content": "`Game Design` was not included in the results because it is not `> 'Game Design'`. Try it with the greater than or equal to operator.",
"hints": [
"The greater than or equal to operator is `>=`",
"You want to see what rows are `>= 'Game Design'`",
"Use the `SELECT`, `FROM`, and `WHERE` keywords with `*` to view the suggested rows",
"Here's an example: `SELECT <columns> FROM <table> WHERE <condition>;`",
"The condition you want is `major >= 'Game Design'`",
"Enter `SELECT * FROM majors WHERE major >= 'Game Design';` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1440",
"title": "psql SELECT WHERE major < G",
"summary": "",
"content": "",
"steps": [
{
"id": "1440.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"b036ae1026e8aada92fe99d8dd447ce81fcad668"
]
},
"content": "It included `Game Design` in the results that time. So if you want to see results that start with a `G` or after, you could use `major >= 'G'`. View the majors that come before `G`.",
"hints": [
"Use the less than (`<`) operator to see rows that come before `G`",
"Use the `SELECT`, `FROM`, and `WHERE` keywords with `*` to view the suggested rows",
"Here's an example: `SELECT <columns> FROM <table> WHERE <condition>;`",
"The condition you want is `major < 'G'`",
"Enter `SELECT * FROM majors WHERE major < 'G';` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1450",
"title": "Add echo query result",
"summary": "",
"content": "",
"steps": [
{
"id": "1450.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"123186d0509c656d61d18c3b08465c3a7bc6d8b7"
]
},
"content": "In your script, add an `echo` at the bottom to print the suggested info like you did before. Make sure to use double quotes where needed.",
"hints": [
"Add `echo \"$($PSQL \"<query_here>\")\"` to the bottom of the `student_info.sh` file, except with the correct query in it",
"You previously used, `SELECT * FROM majors WHERE major < 'G';` in the psql prompt",
"The condition you want here is `WHERE course < 'D'`",
"You only want to get the `course` column from the `courses` table",
"Practice the query in the psql prompt to make sure it's getting what you want",
"If you run your script, the last echo statement should print:\n```sh\nComputer Networks\nComputer Systems\nArtificial Intelligence\nCalculus\nAlgorithms\n```",
"Add `echo \"$($PSQL \"SELECT course FROM courses WHERE course < 'D'\")\"` to the bottom of the `student_info.sh` file"
]
}
]
},
{
"id": "1460",
"title": "./student_info.sh",
"summary": "",
"content": "",
"steps": [
{
"id": "1460.1",
"setup": {
"watchers": [
"../.bash_history"
],
"commits": [
"4e8d4f09ef41cec8bf4f3d7d578c9b341603302f"
]
},
"content": "Run the script to see what course names come before the letter `D`.",
"hints": [
"Run your `student_info.sh` script by executing it",
"Type `./student_info.sh` in the terminal and press enter",
"Make sure you are in the `project` folder first"
]
}
]
},
{
"id": "1470",
"title": "Add echo students after R with gpa above 3.8 or below 2.0",
"summary": "",
"content": "",
"steps": [
{
"id": "1470.1",
"setup": {
"watchers": [
"./student_info.sh"
],
"commits": [
"9ed5bd7f539d106b44754d5074ea123a0f6cd30b"
]
},
"content": "Looks like there is five of them. Add another sentence like the others that says: `First name, last name, and GPA of students whose last name begins with an 'R' or after and have a GPA greater than 3.8 or less than 2.0:`",
"hints": [
"At the bottom of the file, use `echo` with the `-e` flag and a new line character again to print the suggested sentence",
"The new line character is `\\n`",
"Here's an example of the command: `echo -e \"\\n<text_here>\"`",
"At the bottom of the `student_info.sh` file, add this:\n```sh\necho -e \"\\nFirst name, last name, and GPA of students whose last name begins with an 'R' or after and have a GPA greater than 3.8 or less than 2.0:\"\n```"
]
}
]
},
{
"id": "1480",
"title": "psql SELECT * FROM students",
"summary": "",
"content": "",
"steps": [
{
"id": "1480.1",
"setup": {
"watchers": [
"../pg.log"
],
"commits": [
"cbc752c258477be641b260fd96357bc28844fa9e"
]
},
"content": "To find that, start by using the psql prompt to view all the data in the `students` table.",
"hints": [
"Use the `SELECT` and `FROM` keywords with `*` to view all the data",
"Enter `SELECT * FROM students;` in the psql prompt",
"Enter `psql --username=freecodecamp --dbname=students` in the terminal to log into the psql prompt if you aren't already"
]
}
]
},
{
"id": "1490",
"title": "psql SELECT WHERE last_name < M",
"summary": "",
"content": "",
"steps": [