Create View | MariaDB Tutorial for Beginners

Veröffentlicht am: 03 April 2021
auf dem Kanal: Java Code Junkie
6,596
136

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!


Auf dieser Seite können Sie das Online-Video Create View | MariaDB Tutorial for Beginners mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Java Code Junkie 03 April 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 6,596 Mal angesehen und es wurde von 136 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!