MySQL Clients: Creating DB and table

Using an earlier example, let’s go ahead and create a database and a table.

We will use the same code illustrated in the example.

CREATE TABLE artist
    (
 id int auto_increment primary key, 
 artiste varchar(30), 
 album varchar(50),
 price decimal(3, 2) 
 );
  
INSERT INTO artist
(artiste, album, price)
VALUES
('Rod Stewart', 'Maggie May', 8.90 ),
('New Order', 'Substance', 7.50),
('Nirvana', 'Smell Like Teen Spirit', 9.80);

First create the database using

create database allartist

console_create

Now we create a table and insert a row into it.

We need to use use allartist to ensure that the table is created under the table allartist.

console_createtable

console_insert

We can use select * from artist to check if the table has the inserted data.

Series Navigation<< MySQL Clients: Dropping DB and table