SQL Tutorial - Introduction to SQL Server

Welcome to the Course: Mastering T-SQL and SQL Server Databases

Most of the world's data lives in databases, and learning how to access and extract insights from these data is an essential skill for any data scientist or SQL enthusiast. SQL stands for Structured Query Language, and it's the native language for working with databases. In this course, you'll master the fundamentals of T-SQL and become prepared to work with SQL Server databases by writing queries or statements.

Imagine going to a supermarket that is also your database. You want to fill up your card with products, and those products are your query results. Unlike a supermarket, where you can physically retrieve data and manipulate it, you write queries to make this happen. The key term when retrieving data from tables is SELECT. Select statements specify what we want to treat from a table.

The simplest query selects one column from one table. In this query, we select the description column from the table Grid. Note the semicolon, which denotes the end of the query. The other keyword that you will always need is FROM, to specify the location of the source table. Here are the results by default, which return every row in the selected column. You can select multiple columns separating each column name with a comma; however, you do need an alias for the final column.

Here are two similar queries with different aliases. The top query shows all the columns to be selected in one line, while the bottom query shows each selected column on a new line. Both queries will be identical; we'll mainly use the bottom query throughout the course. Keeping keywords such as SELECT and FROM in upper case on table and column names and lower case makes queries easier to read. Instead of returning every row, you can use TOP to limit the number of rows returned, specify the number of rows to return between brackets.

You can also specify a percentage of rows to return using TOP N PERCENT, where n is the percent of rows to return. Using SELECT with TOP is a good way to get a quick view of the contents of the table. You can use SELECT DISTINCT to return a list of unique values from a column; if you used SELECT DISTINCT with two or more columns, you will return each unique combination of values.

"WEBVTTKind: captionsLanguage: enwelcome to the course most of the world's data live in databases so learning how to access and extract insights from these data is an essential skill for any data scientist sequel or SQL stands for structured query language and as the native language for working with databases sequel server is a relational database system developed by Microsoft trans our sequel or T sequel is Microsoft's implementation of sequel with additional functionality in this course you will master the fundamentals of T sequel and become prepared to work with sequel server databases you'll do this by writing queries or statements let's get started think of going to the supermarket we have a store full of goods thus our database we want to fill our card with products and those products are our query results unlike a supermarket we can't physically retrieve our data and manipulate it so we write queries to make this happen the key term when retrieving data from tables is select select statements specify what we want to de treat from a table the simplest query selects one column from one table in this query we select the description column from the table grid note the semicolon which denotes the end of the query the other keyword he will always need is from to specify the location of the source table here are the results by default the query returns every rule in the selected column you can select multiple columns separating each column name with a comma however you do need a color for the final column selected before throne here are two similar queries with differently ads the top query shows all the columns to be selected in one line the bottom query shows each selected column on a new line that is also of both queries will be identical we will mainly use the bottom we head throughout the course keeping keywords such as select and from an upper case on table and column names and lower case makes queries easier to read instead of returning every rule we can use top to limit the number of rows returned specify the number of rows to return between the brackets you can also specify a percentage of rows to return using top n percent where n is the percent of rows to return using select with top is a good way to get a quick view of the contents of the table use select distinct to return a list of unique values from a column if you used select distinct with two or more columns you will return each unique combination of values use select followed by the star or ask to this key to return all the rows and columns in a table this is fine for quick exploration of small tables but not for very large tables or a production code it's better to explicitly select columns so that your queries produce reliable Egberts you can rename or alias a column to make your results were meaningful simply select the colon followed by R's untain your desired column name note her demand loss MW is returned as lost demand our description is returned as cause of outage we've learned quite a lot let's start writing some querieswelcome to the course most of the world's data live in databases so learning how to access and extract insights from these data is an essential skill for any data scientist sequel or SQL stands for structured query language and as the native language for working with databases sequel server is a relational database system developed by Microsoft trans our sequel or T sequel is Microsoft's implementation of sequel with additional functionality in this course you will master the fundamentals of T sequel and become prepared to work with sequel server databases you'll do this by writing queries or statements let's get started think of going to the supermarket we have a store full of goods thus our database we want to fill our card with products and those products are our query results unlike a supermarket we can't physically retrieve our data and manipulate it so we write queries to make this happen the key term when retrieving data from tables is select select statements specify what we want to de treat from a table the simplest query selects one column from one table in this query we select the description column from the table grid note the semicolon which denotes the end of the query the other keyword he will always need is from to specify the location of the source table here are the results by default the query returns every rule in the selected column you can select multiple columns separating each column name with a comma however you do need a color for the final column selected before throne here are two similar queries with differently ads the top query shows all the columns to be selected in one line the bottom query shows each selected column on a new line that is also of both queries will be identical we will mainly use the bottom we head throughout the course keeping keywords such as select and from an upper case on table and column names and lower case makes queries easier to read instead of returning every rule we can use top to limit the number of rows returned specify the number of rows to return between the brackets you can also specify a percentage of rows to return using top n percent where n is the percent of rows to return using select with top is a good way to get a quick view of the contents of the table use select distinct to return a list of unique values from a column if you used select distinct with two or more columns you will return each unique combination of values use select followed by the star or ask to this key to return all the rows and columns in a table this is fine for quick exploration of small tables but not for very large tables or a production code it's better to explicitly select columns so that your queries produce reliable Egberts you can rename or alias a column to make your results were meaningful simply select the colon followed by R's untain your desired column name note her demand loss MW is returned as lost demand our description is returned as cause of outage we've learned quite a lot let's start writing some queries\n"