Create View | MariaDB Tutorial for Beginners

Publicado em: 03 Abril 2021
no canal de: Java Code Junkie
6,294
132

In this MariaDB tutorial for beginners, we are going to learn how to use the CREATE VIEW command. A view is the result set of a stored query on a database. In this tutorial we will create three views.

1. A MariaDB view composed of a single table
2. A MariaDB view composed of two tables with LEFT JOIN
3. A MariaDB view composed of two tables with a LEFT JOIN and a WHERE clause

Here are the three DDL commands for the views that were created in this tutorial.

CREATE VIEW
employee_list1 AS
SELECT employee_id, last_name, first_name
FROM employees
ORDER BY last_name, first_name;

CREATE VIEW
employee_list2 AS
SELECT e.employee_id as 'ID', e.last_name as 'LAST NAME', e.first_name as 'FIRST NAME' , d.text as 'DEPARTMENT'
FROM employees e
LEFT JOIN departments d on(e.dept_id = d.id)
ORDER BY department, last_name, first_name;

CREATE VIEW
employee_list3 AS
SELECT e.employee_id as 'ID', e.last_name as 'LAST NAME', e.first_name as 'FIRST NAME' , d.text as 'DEPARTMENT'
FROM employees e
LEFT JOIN departments d on(e.dept_id = d.id)
WHERE e.dept_id = 2;

========================================================

Check out my YouTube Channel for more FREE videos
   / @javacodejunkie  

Do you want to learn more about Java and how you can grow your skills as a Java Developer? SUBSCRIBE and ring that bell!


Nesta página do site você pode assistir ao vídeo on-line Create View | MariaDB Tutorial for Beginners duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Java Code Junkie 03 Abril 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 6,294 vezes e gostou 132 espectadores. Boa visualização!