This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| 1. How do you find related data held in two separate data tables? | |
| Related data held in two separate data tables are found with an INNER JOIN. | |
| 2. Explain, in your own words, the difference between an INNER JOIN, LEFT OUTER JOIN, and RIGHT OUTER JOIN. Give a real-world example for each. | |
| Inner Join: It is when two tables are combined and the resulting table contain rows that are matching from both tables. | |
| ex. You have a table containing all the available arts classes with a classid ,class names and enrollment number at an university and in another table you have the students table, with the name of every student in the university regardless of whether they are taking arts classes or not and the corresponding classid enrolment. You can combine both tables using an inner join to only display the names of students taking arts classes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### EXERCISES | |
| 1. Write out a generic SELECT statement. | |
| SELECT numbers | |
| FROM table1 | |
| WHERE numbers > 4 | |
| 2. Create a fun way to remember the order of operations in a SELECT statement, such as a mnemonic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| Use the commands above to complete the following tasks, and submit the SQL statements. Real-world examples must be distinct from those used in the text. | |
| 1. List the commands for adding, updating, and deleting data. | |
| Adding: INSERT INTO | |
| Updating: UPDATE | |
| Deleting: DELETE | |
| Altering a table: ALTER TABLE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### EXERCISE | |
| Create a database called library using the appropriate Postgres command line tools. | |
| Download and execute this file in the database: Library Data | |
| Run the following query using psql to confirm that the data was imported correctly. | |
| Create a gist with the results and submit the answers. | |
| #### RESULTS | |
| id | title | author |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| 1. What data types do each of these values represent? | |
| "A Clockwork Orange" : String | |
| 42 : Integer | |
| 09/02/1945 : Integer/Date | |
| 98.7: Float | |
| $15.99: Float/Currency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### EXERCISES | |
| 1. Write pseudocode for bubble sort. | |
| FUNCTION bubbleSort (array) | |
| DO | |
| SET SWAPPED to false | |
| FOR first index of array to last index of collection - 1 | |
| IF array[i] > array[i+1] | |
| SET tmp to array[i] | |
| SET array[i] to array[i+1] | |
| SET array[i+1]to tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| Short Answer : | |
| 1. What is a real-life scenario that uses linear search? | |
| You need to find a certain article on a magazine without knowing the page number. In this scenario, each page starting from the first page would be checked until the article was found. | |
| 2. What is a real-life scenario that uses binary search? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| 1. Define and compare recursion and iteration. | |
| Recursion is a procedure that calls itself until a certain condition (base case) is reached. Recursive solutions can be slower and are subjected to system limitations | |
| Iteration is a procedure that uses loop to repeat a process. Iterative solutions may be harder to implement. | |
| 2. Name five algorithms that are commonly implemented by recursion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| 1. What is time complexity and what is its relation to algorithms? | |
| Time complexity is the measuring of the time that takes to execute a program and it is usually expressed as a function. Time Complexity Analysis is used to describe how efficient an algorithm is based on the input size. | |
| 2. What is runtime? | |
| Runtime is the physical time duration that an algorithm takes to complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### EXERCISES | |
| 1. Using proper pseudo-code, describe the following primitive algorithms: | |
| MAKING COFFEE | |
| FUNCTION makingCoffeeKeurig() | |
| GET Coffee Pod and water | |
| PUT Coffee Pod and water in Keurig | |
| IF Keurig Machine light is not green | |
| WAIT | |
| ELSE |
NewerOlder