From the course: MySQL Data Analysis

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Selecting specific columns

Selecting specific columns - MySQL Tutorial

From the course: MySQL Data Analysis

Selecting specific columns

- [Instructor] Sometimes you might want to select data from a table, but you don't need all of the columns. I'm going to walk you through how you select specific columns from a table now. You can return one or more specific columns by naming them explicitly in your select statement. To select data from multiple columns, you'll separate the column names with a comma. Here's a pro tip, use line breaks and indentation to make sure that your code is human readable. This won't matter when your queries are very simple, but as you get more advanced and start writing more and more complex SQL queries, this will become more important for you. Here's an example of selecting two columns from our rental table. Go ahead and take this query and type it into your MySQL Workbench interface. Notice how I've broken my query into multiple lines with the select and the from furthest to the left and then used indentation for the various column names. This makes it really easy for you or anyone else…

Contents