

Whether you're a novice or experience DBA, Navicat's Query Builder makes writing SELECT queries easier than ever before. The results will be sorted by Film title:

INNER JOIN film AS f ON fa.film_id = f.film_id INNER JOIN film_actor AS fa ON fa.actor_id = a.actor_id You should now see the generated SELECT statement in the Query Editor: This time enter a value of "2006" in the Edit tab. Next, click on the right-hand " = " to set the release year.Click the List tab and choose the f.release_year field.That opens a popup dialog that contains a List of fields as well as an Edit tab. Click on the left-hand " = " to select a field.Select the actor first and last names as well as the film title.Ĭlicking on "" beside the WHERE keyword adds a default WHERE condition of " = ". To include all the fields, click at the left of the object caption. To include a field in the query, check the left of the field name in the Diagram Design pane.That's because foreign key constraints have already been declared on Table objects: Note how the Query Builder already knows the table relationships. To add the table alias, simply double-click the table name and enter the alias in the Diagram Design pane. You can assign table aliases by clicking on "" beside each table.We'll be needing the actor, film_actor, and film tables. Drag a table/view from the left pane to the Diagram Design pane or double-click it to add it to query.It's a good idea to select the tables first, so that the Query Builder knows which fields to present for the field list: The database objects are displayed in left pane, whereas the right pane is divided into two portions: the upper Diagram Design pane, and the lower Syntax pane:Ĭonstructing the Actors for Year's Films Query

In the Query Designer, click the Query Builder button to open the visual SQL Builder.Click the Query icon on the main toolbar, followed by the New Query button from the Object toolbar:.Let's bring it up by opening a new query: It's accessible from the Query Designer screen. You can think of the Query Builder as a tool for building queries visually. Please refer to the Generating Reports on MySQL Data tutorial for instructions on downloading and installing the Sakila database. The database contains a number of tables themed around the film industry that cover everything from actors and film studios to video rental stores. A former member of the MySQL AB documentation team named Mike Hillyer created the Sakila database specifically for the purpose of providing a standard schema for use in books, tutorials, and articles just like the one you're reading. The query that we'll be building will run against the Sakila sample database. In today's blog, we'll use it to write a query to fetch a list of actors that appeared in movies released during a given year. Available in Non-Essentials editions of Navicat for MySQL, PostgreSQL, SQLite, MariaDB, and Navicat Premium, the Query Builder allows anyone to create and edit queries with only a cursory knowledge of SQL.
