Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Tables aliases | Selecting
SQL Basics
course content

Зміст курсу

SQL Basics

SQL Basics

1. Selecting
2. Filtering
3. Aggregating
4. Sorting
5. Grouping
6. Practicing

Tables aliases

As for columns, you can also assign some alias to the table name. It is very useful when you work with multiple tables at once, as they may have identical names.

To assign an alias to a table name use the same syntax as for columns. For example,

12
SELECT column1, column2 FROM table_name AS t
copy

With this technique, you can refer to certain columns by using alias.column. It also works for the whole table name. For example,

12
SELECT t.column1, t.column2 FROM table_name AS t
copy

and

12
SELECT table_name.column1, table_name.column2 FROM table_name
copy

queries will return the same result. It's all about usability.

Завдання

Extract columns model, price, fueltype, and mpg from audi_cars table. Use a alias for the table and extract columns using this alias. Print first 10 rows.

Завдання

Extract columns model, price, fueltype, and mpg from audi_cars table. Use a alias for the table and extract columns using this alias. Print first 10 rows.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 9
toggle bottom row

Tables aliases

As for columns, you can also assign some alias to the table name. It is very useful when you work with multiple tables at once, as they may have identical names.

To assign an alias to a table name use the same syntax as for columns. For example,

12
SELECT column1, column2 FROM table_name AS t
copy

With this technique, you can refer to certain columns by using alias.column. It also works for the whole table name. For example,

12
SELECT t.column1, t.column2 FROM table_name AS t
copy

and

12
SELECT table_name.column1, table_name.column2 FROM table_name
copy

queries will return the same result. It's all about usability.

Завдання

Extract columns model, price, fueltype, and mpg from audi_cars table. Use a alias for the table and extract columns using this alias. Print first 10 rows.

Завдання

Extract columns model, price, fueltype, and mpg from audi_cars table. Use a alias for the table and extract columns using this alias. Print first 10 rows.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 9
toggle bottom row

Tables aliases

As for columns, you can also assign some alias to the table name. It is very useful when you work with multiple tables at once, as they may have identical names.

To assign an alias to a table name use the same syntax as for columns. For example,

12
SELECT column1, column2 FROM table_name AS t
copy

With this technique, you can refer to certain columns by using alias.column. It also works for the whole table name. For example,

12
SELECT t.column1, t.column2 FROM table_name AS t
copy

and

12
SELECT table_name.column1, table_name.column2 FROM table_name
copy

queries will return the same result. It's all about usability.

Завдання

Extract columns model, price, fueltype, and mpg from audi_cars table. Use a alias for the table and extract columns using this alias. Print first 10 rows.

Завдання

Extract columns model, price, fueltype, and mpg from audi_cars table. Use a alias for the table and extract columns using this alias. Print first 10 rows.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

As for columns, you can also assign some alias to the table name. It is very useful when you work with multiple tables at once, as they may have identical names.

To assign an alias to a table name use the same syntax as for columns. For example,

12
SELECT column1, column2 FROM table_name AS t
copy

With this technique, you can refer to certain columns by using alias.column. It also works for the whole table name. For example,

12
SELECT t.column1, t.column2 FROM table_name AS t
copy

and

12
SELECT table_name.column1, table_name.column2 FROM table_name
copy

queries will return the same result. It's all about usability.

Завдання

Extract columns model, price, fueltype, and mpg from audi_cars table. Use a alias for the table and extract columns using this alias. Print first 10 rows.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 9
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt