Library

Video Player is loading.
 
Current Time 0:00
Duration 17:49
Loaded: 0%
 

x1.00


Back

Games & Quizzes

Training Mode - Typing
Fill the gaps to the Lyric - Best method
Training Mode - Picking
Pick the correct word to fill in the gap
Fill In The Blank
Find the missing words in a sentence Requires 5 vocabulary annotations
Vocabulary Match
Match the words to the definitions Requires 10 vocabulary annotations

You may need to watch a part of the video to unlock quizzes

Don't forget to Sign In to save your points

Challenge Accomplished

PERFECT HITS +NaN
HITS +NaN
LONGEST STREAK +NaN
TOTAL +
- //

We couldn't find definitions for the word you were looking for.
Or maybe the current language is not supported

  • 00:00

    Are you using MySQL Workbench and  want to get the most out of it?  
    Are you using MySQL Workbench and  want to get the most out of it?  

  • 00:04

    Or are you getting started with learning MySQL  and want to know how to use this popular tool?
    Or are you getting started with learning MySQL  and want to know how to use this popular tool?

  • 00:08

    You’re in the right place.
    You’re in the right place.

  • 00:11

    In this video, you’ll learn all about the major  features of MySQL Workbench, such as connecting  
    In this video, you’ll learn all about the major  features of MySQL Workbench, such as connecting  

  • 00:15

    to a database, the layout of the tool, and  writing and running SQL queries. You’ll see  
    to a database, the layout of the tool, and  writing and running SQL queries. You’ll see  

  • 00:21

    how to view the different objects on a database,  and how to generate SQL statements from them.
    how to view the different objects on a database,  and how to generate SQL statements from them.

  • 00:27

    You’ll also see how to quickly and easily improve  the formatting and readability of your SQL code.
    You’ll also see how to quickly and easily improve  the formatting and readability of your SQL code.

  • 00:33

    We’ll also cover some handy features, such  as snippets and editing data in the results.
    We’ll also cover some handy features, such  as snippets and editing data in the results.

  • 00:38

    Let’s get started!
    Let’s get started!

  • 00:40

    Welcome to the Database Star YouTube  channel - the place for developers  
    Welcome to the Database Star YouTube  channel - the place for developers  

  • 00:43

    looking to improve their database and SQL skills.
    looking to improve their database and SQL skills.

  • 00:46

    I’ll assume you already have  MySQL Workbench installed.  
    I’ll assume you already have  MySQL Workbench installed.  

  • 00:50

    If not, you can download it from the MySQL  website and follow the steps to install it.
    If not, you can download it from the MySQL  website and follow the steps to install it.

  • 00:55

    You’ll also need access to a MySQL database.  
    You’ll also need access to a MySQL database.  

  • 00:59

    I’ve got a couple of videos on  how to set one up, but in short,  
    I’ve got a couple of videos on  how to set one up, but in short,  

  • 01:02

    you can download the MySQL Community Edition  database from the MySQL website if you need one.
    you can download the MySQL Community Edition  database from the MySQL website if you need one.

  • 01:10

    Once you’ve opened MySQL  Workbench, it looks like this.  
    Once you’ve opened MySQL  Workbench, it looks like this.  

  • 01:13

    This is the Home tab, and it’s shown  whenever you open MySQL Workbench.
    This is the Home tab, and it’s shown  whenever you open MySQL Workbench.

  • 01:18

    The main part of this screen is the  connections, which are these boxes here.  
    The main part of this screen is the  connections, which are these boxes here.  

  • 01:23

    When you open MySQL Workbench for  the first time, this will be empty.  
    When you open MySQL Workbench for  the first time, this will be empty.  

  • 01:27

    I’ve got a lot here because  I’ve used this tool for a while.
    I’ve got a lot here because  I’ve used this tool for a while.

  • 01:30

    A connection is a group of settings that  allow you to connect to a database server  
    A connection is a group of settings that  allow you to connect to a database server  

  • 01:34

    and run queries. You can have multiple  connections set up, like I do here.
    and run queries. You can have multiple  connections set up, like I do here.

  • 01:40

    Let’s create a new connection. To start, click  on the plus button next to MySQL Connections.
    Let’s create a new connection. To start, click  on the plus button next to MySQL Connections.

  • 01:46

    A new window will open. This  is the New Connection window,  
    A new window will open. This  is the New Connection window,  

  • 01:50

    and it’s where you enter all of the  details for your MySQL database connection.
    and it’s where you enter all of the  details for your MySQL database connection.

  • 01:55

    Enter the details to connect to the database.  This could be a database running on your computer  
    Enter the details to connect to the database.  This could be a database running on your computer  

  • 02:00

    or on another server. The exact details will  depend on how you’ve set up your database,  
    or on another server. The exact details will  depend on how you’ve set up your database,  

  • 02:05

    which might be different to mine. If you’ve set  up a database on your computer, for example,  
    which might be different to mine. If you’ve set  up a database on your computer, for example,  

  • 02:10

    you may use the server name of  localhost and the username of root.
    you may use the server name of  localhost and the username of root.

  • 02:15

    Enter the connection name, which is the name  you want to give the connection, and will  
    Enter the connection name, which is the name  you want to give the connection, and will  

  • 02:19

    show on the Home tab. I’ll call this one “MySQL  Demo” but you can call yours whatever you like.
    show on the Home tab. I’ll call this one “MySQL  Demo” but you can call yours whatever you like.

  • 02:27

    Enter the username. You can specify a  password by clicking on Store in Keychain,  
    Enter the username. You can specify a  password by clicking on Store in Keychain,  

  • 02:32

    which will store the password you enter and not  ask you for the password every time you connect.  
    which will store the password you enter and not  ask you for the password every time you connect.  

  • 02:38

    If you want to enter it every time for  security reasons, you can skip this.
    If you want to enter it every time for  security reasons, you can skip this.

  • 02:42

    Once you’ve entered the connection details, click  on the Test Connection button. This will simulate  
    Once you’ve entered the connection details, click  on the Test Connection button. This will simulate  

  • 02:48

    a connection to the database, and it’s a good  way to check that the details you have entered  
    a connection to the database, and it’s a good  way to check that the details you have entered  

  • 02:52

    are correct. If they are, it will show a success  message. If not, you can investigate the issue and  
    are correct. If they are, it will show a success  message. If not, you can investigate the issue and  

  • 02:59

    correct it. The possible causes and solutions of  connection errors are something for another video.
    correct it. The possible causes and solutions of  connection errors are something for another video.

  • 03:05

    Once the connection test is successful,  click OK and the connection will be saved.
    Once the connection test is successful,  click OK and the connection will be saved.

  • 03:10

    The connection will show as  a new box on the Home tab,  
    The connection will show as  a new box on the Home tab,  

  • 03:13

    with the name you gave it on the top of the box.
    with the name you gave it on the top of the box.

  • 03:16

    If you get some of the details wrong,  
    If you get some of the details wrong,  

  • 03:18

    or want to change a connection  after you have created it, you can.
    or want to change a connection  after you have created it, you can.

  • 03:23

    To do this, right-click on the connection  box and select Edit Connection. Or, you can  
    To do this, right-click on the connection  box and select Edit Connection. Or, you can  

  • 03:28

    click on the spanner icon next to the plus icon  here, which opens a window of all connections.
    click on the spanner icon next to the plus icon  here, which opens a window of all connections.

  • 03:34

    Select the connection you want to edit,  change the details you need to change,  
    Select the connection you want to edit,  change the details you need to change,  

  • 03:38

    click Test Connection to test it, and click Close.
    click Test Connection to test it, and click Close.

  • 03:42

    You can also add new  connections, delete connections,  
    You can also add new  connections, delete connections,  

  • 03:45

    duplicate existing connections, and move  connections up and down the list in this window.
    duplicate existing connections, and move  connections up and down the list in this window.

  • 03:50

    Click Close when you’re done.
    Click Close when you’re done.

  • 03:53

    To connect to a database, click on  the connection box. MySQL Workbench  
    To connect to a database, click on  the connection box. MySQL Workbench  

  • 03:58

    will connect to the database. After a  moment, the database should be connected.
    will connect to the database. After a  moment, the database should be connected.

  • 04:02

    The screen changes to the main  MySQL Workbench editor. The editor  
    The screen changes to the main  MySQL Workbench editor. The editor  

  • 04:07

    has several panels that serve different purposes.
    has several panels that serve different purposes.

  • 04:10

    At the top, you have a toolbar. This  contains the menus, such as File and Edit.  
    At the top, you have a toolbar. This  contains the menus, such as File and Edit.  

  • 04:16

    On a Mac, they are at the very  top of the screen. On Windows,  
    On a Mac, they are at the very  top of the screen. On Windows,  

  • 04:19

    they are within the application, but in either  case, they are in this area of the screen.
    they are within the application, but in either  case, they are in this area of the screen.

  • 04:25

    You've also got a range of  icons here on the toolbar,  
    You've also got a range of  icons here on the toolbar,  

  • 04:28

    which we will explain later in this video.
    which we will explain later in this video.

  • 04:31

    The middle part of the window is the editor  pane, and this is the main part of the editor.  
    The middle part of the window is the editor  pane, and this is the main part of the editor.  

  • 04:36

    It's where you can write and run SQL queries.  
    It's where you can write and run SQL queries.  

  • 04:39

    There's a toolbar that applies to  this editor that you can see here.
    There's a toolbar that applies to  this editor that you can see here.

  • 04:44

    On the right is a panel that  contains Context Help and Snippets.  
    On the right is a panel that  contains Context Help and Snippets.  

  • 04:48

    We'll look at these features later in this video.
    We'll look at these features later in this video.

  • 04:51

    At the bottom is the output panel, which shows  a log of the queries you run on the database.
    At the bottom is the output panel, which shows  a log of the queries you run on the database.

  • 04:57

    On the left is a panel that shows the schemas,  object browser, and the administration section.
    On the left is a panel that shows the schemas,  object browser, and the administration section.

  • 05:03

    On the top right is a series of buttons  that let you hide the different panels.  
    On the top right is a series of buttons  that let you hide the different panels.  

  • 05:07

    Click on any of them and the left,  bottom, or right panels will be hidden.  
    Click on any of them and the left,  bottom, or right panels will be hidden.  

  • 05:12

    This is helpful if you're working on a  smaller screen or with a larger query.
    This is helpful if you're working on a  smaller screen or with a larger query.

  • 05:17

    At the top left of the window is a home button.  This will take you back to the home screen if  
    At the top left of the window is a home button.  This will take you back to the home screen if  

  • 05:22

    you want to connect to another database. The  tab next to it is the current connection,  
    you want to connect to another database. The  tab next to it is the current connection,  

  • 05:27

    and any further connections you run and  connect to will be shown as separate tabs.
    and any further connections you run and  connect to will be shown as separate tabs.

  • 05:32

    To get started with working with a  database, you may need to create one first.  
    To get started with working with a  database, you may need to create one first.  

  • 05:36

    In MySQL, it’s called a schema, which is  a collection of tables and other objects.
    In MySQL, it’s called a schema, which is  a collection of tables and other objects.

  • 05:42

    On my screen here, I have a few already  created: demo, netflix, sample_csv, and sys.  
    On my screen here, I have a few already  created: demo, netflix, sample_csv, and sys.  

  • 05:49

    If you’ve just installed the MySQL database  software, it may only come with the sys schema,  
    If you’ve just installed the MySQL database  software, it may only come with the sys schema,  

  • 05:54

    which is for system tables and views.
    which is for system tables and views.

  • 05:57

    We should create our own schema  to work in. Let’s do that now.
    We should create our own schema  to work in. Let’s do that now.

  • 06:02

    To create a schema, you can click on  the Create Schema button on the toolbar  
    To create a schema, you can click on  the Create Schema button on the toolbar  

  • 06:06

    which is the cylinder icon with the plus next to  it. Or, you can right-click in the Schemas panel  
    which is the cylinder icon with the plus next to  it. Or, you can right-click in the Schemas panel  

  • 06:11

    on the left and select Create Schema. You can also  run a Create Schema SQL statement if you prefer.
    on the left and select Create Schema. You can also  run a Create Schema SQL statement if you prefer.

  • 06:19

    You’ll see this new Schema Editor tab  appear in the main area of the screen.  
    You’ll see this new Schema Editor tab  appear in the main area of the screen.  

  • 06:23

    Enter a name for the new schema.  We’ll call ours “test_schema”.
    Enter a name for the new schema.  We’ll call ours “test_schema”.

  • 06:29

    You can leave the character set and  collation values as the default.  
    You can leave the character set and  collation values as the default.  

  • 06:32

    Click the small Apply button in the bottom right.
    Click the small Apply button in the bottom right.

  • 06:36

    A window will appear to show you the SQL that  will be run. Click the Apply button to create it.
    A window will appear to show you the SQL that  will be run. Click the Apply button to create it.

  • 06:42

    You should see a success message  appear on the next screen. Click Close.
    You should see a success message  appear on the next screen. Click Close.

  • 06:47

    On the Schemas panel on the left, you’ll  see the new schema appear in the list. To  
    On the Schemas panel on the left, you’ll  see the new schema appear in the list. To  

  • 06:52

    start working with this schema, you’ll need  to make it the active schema. To do this,  
    start working with this schema, you’ll need  to make it the active schema. To do this,  

  • 06:57

    double-click on it in the  list. The name will be bolded,  
    double-click on it in the  list. The name will be bolded,  

  • 07:01

    and this indicates that any queries  you run will be applied to this schema.
    and this indicates that any queries  you run will be applied to this schema.

  • 07:06

    You can also close the Schema  Editor panel that still appears,  
    You can also close the Schema  Editor panel that still appears,  

  • 07:09

    by clicking on the X button  on the top of the tab here.
    by clicking on the X button  on the top of the tab here.

  • 07:14

    In the main query editor, you  can enter your SQL queries.
    In the main query editor, you  can enter your SQL queries.

  • 07:18

    The SQL code has formatting  applied so you can tell SQL  
    The SQL code has formatting  applied so you can tell SQL  

  • 07:21

    keywords apart from table names and strings.
    keywords apart from table names and strings.

  • 07:25

    Let’s run some SQL to create a table. We’ll create  
    Let’s run some SQL to create a table. We’ll create  

  • 07:28

    this simple table here using  this Create Table statement.
    this simple table here using  this Create Table statement.

  • 07:32

    Once you enter a query, you can run it by going to  
    Once you enter a query, you can run it by going to  

  • 07:35

    the Query menu and selecting  Execute Current Statement.
    the Query menu and selecting  Execute Current Statement.

  • 07:39

    You could also click on the  Execute button on the toolbar,  
    You could also click on the  Execute button on the toolbar,  

  • 07:42

    which is the yellow lightning bolt here.  Or you can use the keyboard shortcut,  
    which is the yellow lightning bolt here.  Or you can use the keyboard shortcut,  

  • 07:46

    which on a Mac is command and enter,  and on Windows it's Control and Enter.
    which on a Mac is command and enter,  and on Windows it's Control and Enter.

  • 07:51

    This will run the Create Table statement.
    This will run the Create Table statement.

  • 07:54

    Once you run a query, a new line will appear in  the Output panel at the bottom of the screen.  
    Once you run a query, a new line will appear in  the Output panel at the bottom of the screen.  

  • 07:59

    A line will appear for any type of query you run.
    A line will appear for any type of query you run.

  • 08:03

    It will show a green tick if the query  was successful, or a red X if it was not.  
    It will show a green tick if the query  was successful, or a red X if it was not.  

  • 08:08

    It shows the time the query was run, and the  query that was run. In the Response column it  
    It shows the time the query was run, and the  query that was run. In the Response column it  

  • 08:13

    will show either the error message or the number  of rows affected or something else, depending  
    will show either the error message or the number  of rows affected or something else, depending  

  • 08:18

    on the type of query you ran. The Duration Fetch  Time column shows how long the query took to run.
    on the type of query you ran. The Duration Fetch  Time column shows how long the query took to run.

  • 08:26

    When you run your Create Table  query, you’ll see the line here.
    When you run your Create Table  query, you’ll see the line here.

  • 08:29

    Now we’ve created our table,  let’s add some data to it.
    Now we’ve created our table,  let’s add some data to it.

  • 08:33

    We can do this by running an  Insert statement. We can add an  
    We can do this by running an  Insert statement. We can add an  

  • 08:37

    Insert statement in the editor panel  after the Create Table statement.
    Insert statement in the editor panel  after the Create Table statement.

  • 08:41

    We could delete the Create Table statement,  or we can add it after the statement.  
    We could delete the Create Table statement,  or we can add it after the statement.  

  • 08:45

    It’s up to you. I’ll add the Insert  after the Create Table statement.
    It’s up to you. I’ll add the Insert  after the Create Table statement.

  • 08:51

    You can write and run multiple queries in MySQL  Workbench. You’ll just need to make sure that  
    You can write and run multiple queries in MySQL  Workbench. You’ll just need to make sure that  

  • 08:56

    each query ends with a semicolon, which we  have done for the Create Table statement.
    each query ends with a semicolon, which we  have done for the Create Table statement.

  • 09:01

    We’ve got an insert statement here too.
    We’ve got an insert statement here too.

  • 09:04

    We can either run just the Insert  statement, or we can run both statements.
    We can either run just the Insert  statement, or we can run both statements.

  • 09:09

    You may want to run both statements if you  did not run the Create Table statement before.  
    You may want to run both statements if you  did not run the Create Table statement before.  

  • 09:14

    You could enter both the Create Table and the  Insert, and run both statements in one command.  
    You could enter both the Create Table and the  Insert, and run both statements in one command.  

  • 09:19

    To do this, go to Query and  select Execute All or Selection.  
    To do this, go to Query and  select Execute All or Selection.  

  • 09:24

    You can also click on the lightning bolt  button on the toolbar to execute all queries,  
    You can also click on the lightning bolt  button on the toolbar to execute all queries,  

  • 09:28

    or use the keyboard shortcut of Command Shift  Enter on a Mac, or Control Shift Enter on Windows.
    or use the keyboard shortcut of Command Shift  Enter on a Mac, or Control Shift Enter on Windows.

  • 09:35

    If you want to run only one of the queries, click  inside the query to put your cursor there, and  
    If you want to run only one of the queries, click  inside the query to put your cursor there, and  

  • 09:40

    go to Query then Execute Current Statement. You  can also click on the second lightning bolt icon  
    go to Query then Execute Current Statement. You  can also click on the second lightning bolt icon  

  • 09:46

    on the toolbar here, or use the keyboard shortcut  Command Enter on Mac or Control Enter on Windows.
    on the toolbar here, or use the keyboard shortcut  Command Enter on Mac or Control Enter on Windows.

  • 09:53

    This means that only the statement  under the cursor will be run.
    This means that only the statement  under the cursor will be run.

  • 09:57

    Let’s write a Select query. We can  do this to see the data in our table.
    Let’s write a Select query. We can  do this to see the data in our table.

  • 10:02

    Here’s our Select query. We can run this  statement like we did the other statements  
    Here’s our Select query. We can run this  statement like we did the other statements  

  • 10:06

    by clicking on the second lightning bolt  icon here, or using the keyboard shortcut.
    by clicking on the second lightning bolt  icon here, or using the keyboard shortcut.

  • 10:12

    Once a Select statement is run, a  results panel shows at the bottom  
    Once a Select statement is run, a  results panel shows at the bottom  

  • 10:15

    of the screen with the results of the  query. It shows your results in a table.
    of the screen with the results of the  query. It shows your results in a table.

  • 10:20

    You can scroll the results up and down if  there are more than what can fit in the panel.
    You can scroll the results up and down if  there are more than what can fit in the panel.

  • 10:25

    You can resize the panel by dragging  the border of the panel up and down.  
    You can resize the panel by dragging  the border of the panel up and down.  

  • 10:29

    The border of the panel is this grey line here.
    The border of the panel is this grey line here.

  • 10:33

    You can close the results tab by clicking on the  X on the tab at the bottom of the screen here.  
    You can close the results tab by clicking on the  X on the tab at the bottom of the screen here.  

  • 10:38

    This will give you more  room to work with the query.
    This will give you more  room to work with the query.

  • 10:41

    On the left of the results tab name is a pin  icon. Clicking on this will pin the results tab,  
    On the left of the results tab name is a pin  icon. Clicking on this will pin the results tab,  

  • 10:47

    which means that when you run another query, this  results tab stays on the screen and the next set  
    which means that when you run another query, this  results tab stays on the screen and the next set  

  • 10:52

    of results is shown in a new tab. Without this,  the tab of results disappears and is replaced  
    of results is shown in a new tab. Without this,  the tab of results disappears and is replaced  

  • 10:58

    with the new query. So, this is helpful if you  want to keep your results in between queries.
    with the new query. So, this is helpful if you  want to keep your results in between queries.

  • 11:03

    We’ve written a few queries  in our SQL editor tab here.  
    We’ve written a few queries  in our SQL editor tab here.  

  • 11:07

    A handy feature of most SQL IDEs, including MySQL  Workbench, is the ability to save this file.
    A handy feature of most SQL IDEs, including MySQL  Workbench, is the ability to save this file.

  • 11:14

    To save the queries we have written, either  click on the Save icon on the toolbar here,  
    To save the queries we have written, either  click on the Save icon on the toolbar here,  

  • 11:19

    or go to File and then Save Script, or press  Command S on a Mac or Control S on Windows.
    or go to File and then Save Script, or press  Command S on a Mac or Control S on Windows.

  • 11:25

    You’ll be asked for a location to save the file.  
    You’ll be asked for a location to save the file.  

  • 11:28

    Browse to a location where you want  to save it, and enter a filename.  
    Browse to a location where you want  to save it, and enter a filename.  

  • 11:33

    You’ll notice that the file extension is .sql,  which is the standard file type for SQL scripts.
    You’ll notice that the file extension is .sql,  which is the standard file type for SQL scripts.

  • 11:40

    Click Save, and the file is saved.
    Click Save, and the file is saved.

  • 11:42

    To clarify, this will save the SQL statements you  have written in the editor. It does not save the  
    To clarify, this will save the SQL statements you  have written in the editor. It does not save the  

  • 11:48

    data into the database. Saving the data in the  database is done using a concept called “commit”.
    data into the database. Saving the data in the  database is done using a concept called “commit”.

  • 11:54

    If you want to save your  data, or commit your data,  
    If you want to save your  data, or commit your data,  

  • 11:57

    you can click the blue tick button on  the toolbar here. This will permanently  
    you can click the blue tick button on  the toolbar here. This will permanently  

  • 12:01

    save changes made to your data, such as  what we added using our Insert statement.  
    save changes made to your data, such as  what we added using our Insert statement.  

  • 12:06

    I’ll cover the concept of committing and  the reason it’s needed in another video.
    I’ll cover the concept of committing and  the reason it’s needed in another video.

  • 12:11

    At the bottom of the screen there is the  Output panel which we mentioned earlier.  
    At the bottom of the screen there is the  Output panel which we mentioned earlier.  

  • 12:15

    This is helpful if you want to  see what has been run recently.
    This is helpful if you want to  see what has been run recently.

  • 12:19

    You can re-run one of the queries by copying it to  the editor. To do this, right-click on the row in  
    You can re-run one of the queries by copying it to  the editor. To do this, right-click on the row in  

  • 12:24

    the output you want to run again, and select  either "Append Selected Items to SQL Script"  
    the output you want to run again, and select  either "Append Selected Items to SQL Script"  

  • 12:30

    if you want to add the script to the end  of your editor, or "Replace SQL Script  
    if you want to add the script to the end  of your editor, or "Replace SQL Script  

  • 12:34

    with Selected Items" if you want to replace  what's in the editor with the selected query.
    with Selected Items" if you want to replace  what's in the editor with the selected query.

  • 12:39

    You can then run the query like normal.
    You can then run the query like normal.

  • 12:42

    On the left of the MySQL workbench window  is something called the Object Browser.  
    On the left of the MySQL workbench window  is something called the Object Browser.  

  • 12:47

    This is on the Schemas tab here.
    This is on the Schemas tab here.

  • 12:49

    It shows a list of databases on  the server you have connected to.
    It shows a list of databases on  the server you have connected to.

  • 12:54

    If you click on the arrow to the left of the  database name, it will be expanded to show  
    If you click on the arrow to the left of the  database name, it will be expanded to show  

  • 12:58

    several object types, which are Tables,  Views, Stored Procedures, and Functions.
    several object types, which are Tables,  Views, Stored Procedures, and Functions.

  • 13:04

    If you click the arrow next to one of the  items, such as Tables, it will be expanded.  
    If you click the arrow next to one of the  items, such as Tables, it will be expanded.  

  • 13:10

    In this example, we see a list of tables  in the database in alphabetical order.
    In this example, we see a list of tables  in the database in alphabetical order.

  • 13:14

    You can click on any of the table names and  information about the table will be shown below.  
    You can click on any of the table names and  information about the table will be shown below.  

  • 13:20

    We can see the columns, the data type, and size.  
    We can see the columns, the data type, and size.  

  • 13:23

    Primary keys are underlined,  and foreign keys are bolded.
    Primary keys are underlined,  and foreign keys are bolded.

  • 13:28

    You can expand the arrow next to the table name  in the object browser to see groups of columns,  
    You can expand the arrow next to the table name  in the object browser to see groups of columns,  

  • 13:33

    indexes, foreign keys, and triggers.
    indexes, foreign keys, and triggers.

  • 13:35

    Expand the Columns entry and you can  see all of the columns. You can click  
    Expand the Columns entry and you can  see all of the columns. You can click  

  • 13:40

    on a column and some information about it will  be shown in the section on the bottom right.
    on a column and some information about it will  be shown in the section on the bottom right.

  • 13:45

    A handy feature of MySQL Workbench is the  ability to generate SQL from existing objects.
    A handy feature of MySQL Workbench is the  ability to generate SQL from existing objects.

  • 13:51

    This can save you time when writing  queries or creating objects.
    This can save you time when writing  queries or creating objects.

  • 13:55

    To see this, right-click on an object  in the Object Explorer, such as a table.
    To see this, right-click on an object  in the Object Explorer, such as a table.

  • 14:00

    Select Copy to Clipboard, and  you can see a range of options.
    Select Copy to Clipboard, and  you can see a range of options.

  • 14:05

    You can copy the name, a select statement,  insert, update, delete, or a create statement.
    You can copy the name, a select statement,  insert, update, delete, or a create statement.

  • 14:11

    For example, if we select Insert, it will copy an  insert statement for this table to the clipboard.
    For example, if we select Insert, it will copy an  insert statement for this table to the clipboard.

  • 14:17

    We can then paste this into the SQL  editor, and this statement will be shown.  
    We can then paste this into the SQL  editor, and this statement will be shown.  

  • 14:22

    It automatically adds all of the column  names and placeholders for the values.  
    It automatically adds all of the column  names and placeholders for the values.  

  • 14:27

    Now you can just add in the values you want  and run the statement, saving you time.
    Now you can just add in the values you want  and run the statement, saving you time.

  • 14:32

    You can import and export data using MySQL  Workbench. You may want to import data into a  
    You can import and export data using MySQL  Workbench. You may want to import data into a  

  • 14:38

    table from a CSV file, or export data from a table  into a CSV file or a series of SQL statements.
    table from a CSV file, or export data from a table  into a CSV file or a series of SQL statements.

  • 14:46

    I’ll cover the full process of importing  and exporting in another video,  
    I’ll cover the full process of importing  and exporting in another video,  

  • 14:49

    as it’s probably too long to fit into this  video, but I’ll show you how to find it.
    as it’s probably too long to fit into this  video, but I’ll show you how to find it.

  • 14:55

    To import data into a database, right click on  your schema and select Table Data Import Wizard.  
    To import data into a database, right click on  your schema and select Table Data Import Wizard.  

  • 15:02

    You can follow the steps in this wizard  to select the source of your data,  
    You can follow the steps in this wizard  to select the source of your data,  

  • 15:05

    the destination such as a new or existing  table, and a range of other settings.
    the destination such as a new or existing  table, and a range of other settings.

  • 15:10

    To export data, you’ll need to  find a table that already has data,  
    To export data, you’ll need to  find a table that already has data,  

  • 15:14

    by expanding the list in the Schema Browser.  
    by expanding the list in the Schema Browser.  

  • 15:18

    Right-click on the table you want to export  data for, and select Table Data Export Wizard.  
    Right-click on the table you want to export  data for, and select Table Data Export Wizard.  

  • 15:23

    Once again, follow the steps in this wizard by  selecting the output format and other settings.
    Once again, follow the steps in this wizard by  selecting the output format and other settings.

  • 15:29

    When you start to work with longer SQL  statements, they can get quite messy.
    When you start to work with longer SQL  statements, they can get quite messy.

  • 15:34

    An easy way to clean up your editor is to  format the code to make it easier to read.  
    An easy way to clean up your editor is to  format the code to make it easier to read.  

  • 15:39

    This can be done easily with the Beautify command.
    This can be done easily with the Beautify command.

  • 15:43

    Click the brush button on the toolbar here,  
    Click the brush button on the toolbar here,  

  • 15:45

    and the SQL script will be  formatted to be easier to read.
    and the SQL script will be  formatted to be easier to read.

  • 15:49

    You can also quickly change your  keywords to upper case or lower case  
    You can also quickly change your  keywords to upper case or lower case  

  • 15:53

    by going to Edit, then Format, then  either Upcase or Lowercase your keywords
    by going to Edit, then Format, then  either Upcase or Lowercase your keywords

  • 16:01

    Another helpful feature of MySQL  Workbench is the Snippets feature.  
    Another helpful feature of MySQL  Workbench is the Snippets feature.  

  • 16:05

    A snippet is a piece of code that  you can save and use at a later time.
    A snippet is a piece of code that  you can save and use at a later time.

  • 16:10

    You can save your own code snippets by clicking  this button on the toolbar, the one that looks  
    You can save your own code snippets by clicking  this button on the toolbar, the one that looks  

  • 16:15

    like a star. It will be added to the My  Snippets section on the panel on the right.
    like a star. It will be added to the My  Snippets section on the panel on the right.

  • 16:20

    You can edit the snippet by clicking  on it and editing it. There is also  
    You can edit the snippet by clicking  on it and editing it. There is also  

  • 16:24

    a range of buttons here that let you replace,  insert, or copy the snippet to the clipboard.
    a range of buttons here that let you replace,  insert, or copy the snippet to the clipboard.

  • 16:30

    It's helpful if you find yourself running  the same SQL statements over and over.
    It's helpful if you find yourself running  the same SQL statements over and over.

  • 16:36

    The last feature we'll look at is the ability  to edit the table data in your results.
    The last feature we'll look at is the ability  to edit the table data in your results.

  • 16:41

    If you run a query that has a unique identifier  of a table in it, such as the primary key,  
    If you run a query that has a unique identifier  of a table in it, such as the primary key,  

  • 16:46

    you're able to edit the data in the table in the  results panel. I’ll change to another database,  
    you're able to edit the data in the table in the  results panel. I’ll change to another database,  

  • 16:52

    the netflix one, as we can use a table  such as genres which has a primary key.
    the netflix one, as we can use a table  such as genres which has a primary key.

  • 16:57

    You'll know it's editable if you  see a greyed-out Apply button in the  
    You'll know it's editable if you  see a greyed-out Apply button in the  

  • 17:00

    bottom right corner. If the results are not  editable, then you'll see a Read Only icon.
    bottom right corner. If the results are not  editable, then you'll see a Read Only icon.

  • 17:06

    To edit a value, double-click on a cell  in the results table and adjust the value.  
    To edit a value, double-click on a cell  in the results table and adjust the value.  

  • 17:11

    Once you are finished editing, click  the Apply button in the bottom right,  
    Once you are finished editing, click  the Apply button in the bottom right,  

  • 17:15

    then click the Apply button on the popup to  apply the changes. The data is then updated.
    then click the Apply button on the popup to  apply the changes. The data is then updated.

  • 17:22

    As you can see, MySQL Workbench is a powerful  tool for working with MySQL databases.  
    As you can see, MySQL Workbench is a powerful  tool for working with MySQL databases.  

  • 17:27

    I’ve only covered some of the more common  features of the tool. There are a range of  
    I’ve only covered some of the more common  features of the tool. There are a range of  

  • 17:31

    other features which you might find useful,  and I’ll look to cover them in future videos.
    other features which you might find useful,  and I’ll look to cover them in future videos.

  • 17:37

    If you want to learn more about database design  and SQL, visit my website at databasestar.com.
    If you want to learn more about database design  and SQL, visit my website at databasestar.com.

  • 17:43

    If you liked this video, consider  subscribing to my channel.
    If you liked this video, consider  subscribing to my channel.

  • 17:46

    Thanks for watching.
    Thanks for watching.

All

MySQL Workbench Tutorial (2022)

22,700 views

Video Language:

  • English

Caption Language:

  • English (en)

Accent:

  • English (UK)

Speech Time:

86%
  • 15:21 / 17:49

Speech Rate:

  • 210 wpm - Fast

Category:

  • Science & Technology

Intro:

Are you using MySQL Workbench and  want to get the most out of it?  
Or are you getting started with learning MySQL  and want to know how to use this popular tool?
You’re in the right place.. In this video, you’ll learn all about the major  features of MySQL Workbench, such as connecting  
to a database, the layout of the tool, and  writing and running SQL queries. You’ll see  
how to view the different objects on a database,  and how to generate SQL statements from them.
You’ll also see how to quickly and easily improve  the formatting and readability of your SQL code.
We’ll also cover some handy features, such  as snippets and editing data in the results.
Let’s get started!. Welcome to the Database Star YouTube  channel - the place for developers  
looking to improve their database and SQL skills.. I’ll assume you already have  MySQL Workbench installed.  
If not, you can download it from the MySQL  website and follow the steps to install it.
You’ll also need access to a MySQL database.  . I’ve got a couple of videos on  how to set one up, but in short,  
you can download the MySQL Community Edition  database from the MySQL website if you need one.
Once you’ve opened MySQL  Workbench, it looks like this.  
This is the Home tab, and it’s shown  whenever you open MySQL Workbench.
The main part of this screen is the  connections, which are these boxes here.  
When you open MySQL Workbench for  the first time, this will be empty.  

Video Vocabulary

/ˈdadəˌbās/

noun

Data stored in logical order to aid retrieval.

/stärt/

verb

To do, be or happen for the first time; begin.

/kəˈmyo͞onədē/

noun

group of people with common characteristic.

/ˈsnipit/

noun other

small piece or brief extract. A small piece, as of information.

/ɡet/

verb

To understand something being said or read.

/ˈCHanl/

noun verb

Method or route used for sending or getting things. To dig a long hole for carrying water.

/ˈjenəˌrāt/

verb

To create or be produced or bring into existence.

/ˈlo͝okiNG/

adjective verb

having specified appearance. To appear to be when you look at them; seem.

/ˈdounˌlōd/

noun verb

Transfer of data from the internet to a computer. copy data from one computer system to another.

/(h)wenˈevər/

adverb conjunction

used for emphasis instead of 'when' in questions. at whatever time.

/ˈstātmənt/

noun other

definite or clear expression of something in speech. Acts or processes of saying some things formally.

/ˌôlˈredē/

adverb

Having happened or been done before this time.