• support@answerspoint.com

How to execute multiple SQL queries in MySQL Workbench?

Packers and Movers in Patna
2864

I am using MySQL Workbench CE for Windows version 5.2.40.

I want to execute the following SQL queries together. However I can only execute the SQL queries by first executing the CREATE TABLE query, and then executing the INSERT INTO query and after that executing the SELECT query.

CREATE TABLE testTable(
    Name VARCHAR(20),
    Address VARCHAR(50),
    Gender VARCHAR(10)
)

INSERT INTO testTable
    VALUES
    ('Derp', 'ForeverAlone Street', 'Male'),
    ('Derpina', 'Whiterun Breezehome', 'Female')

Select * FROM testTable

So how do I execute the CREATE TABLEINSERT INTO and the SELECT queries by one click?

1Answer


0

Add a semicolon after each statement:


CREATE TABLE testTable(
    Name VARCHAR(20),
    Address VARCHAR(50),
    Gender VARCHAR(10)
);

INSERT INTO testTable
VALUES
('Derp', 'ForeverAlone Street', 'Male'),
('Derpina', 'Whiterun Breezehome', 'Female');

SELECT * FROM testTable;

 

  • answered 6 years ago
  • B Butts

Packers and Movers in Patna

Your Answer

    Facebook Share        
       
  • asked 6 years ago
  • viewed 2864 times
  • active 6 years ago

Best Rated Questions