Uncovering the Magic of SQL Query: My Latest Tutorial Progress
My learning journey this week has involved discovering the importance and function of queries. Ultimately, queries speaks to the primary function of the SQL language. At the heart of SQL lies the ability to extract information from a database. This process is called querying. A query can be thought of as way to ask a database a question, and for the database to then reply with answer. This process allows one to access and make sense of the data in a database, thus unleashing its power as a valuable resource for analysis,
The first step was to learn how to query for multiple columns in one search statement. I was able to input the statement and return data that is only contained in the columns noted, as opposed to the original 5 columns that were in the table. I was also able to rename columns using an alias via using AS in leu of FROM in a SELECT statement. One important aspect of the AS clause is that it can be used to make an alias for table names. This can come in handy when one is working with multiple tables in a single query. Also, being able to use alias makes results more readable, and queries more concise.
I also learned how to filter the data that is returned by using comparison operators added to conditions, and returning values that have a alike values. I had practice with using SQL's If-Then logic by way of working with CASE statements. I found CASE statements to be exceptionally powerful as it does allow one to add conditional logic to queries. The standard CASE statement, once executed, will first evaluate its proposed condition, then return the results of said condition only if the condition is found to be true.. If there are multiple conditions, as seen in the above example, then each condition is evaluated. Where conditions are found to be true the THEN action is then applied, but, if conditions are found to false then the ELSE action will be applied.
In the upcoming week, I am going to explore how to effectively use the SQL language to execute calculations!





Comments
Post a Comment