Search code examples
mysqldatabasedatatablemysql-workbenchworkbench

Is there a simple way to get SQL Workbench to only focus on one database?


Through my code I am having to write the database before the table name because otherwise I get an error as it's looking in the wrong database for the table I created. If you look at my code I am always writing sql_intro.emp_details rather than just emp_details. Is there a simpler way to do this?

This is my code:

create database sql_intro; show databases;

create table sql_intro.emp_details (Name varchar(25), Age int, Sex char(1), doj date, City varchar(15), Salary float);

describe sql_intro.emp_details;

insert into sql_intro.emp_details values("Jimmy",35,"M","2005-05-30","Chicago",70000), ("Shane",30,"M","1999-06-25","Seattle",55000), ("Marry",28,"F","2009-03-10","Boston",62000), ("Dwayne",37,"M","2011-07-12","Austin",57000), ("Sara",32,"F","2017-10-27","New York",72000), ("Ammy",35,"F","2014-12-20","Seattle",80000);

Select * from sql_intro.emp_details;


Solution

  • use sql_intro;

    will switch your database