Previously on Phoebe’s get started with TIDB trilogy: we used TiUP and deployed our sandbox environment - playground. We have also successfully connected to mysql client. Now we are ready for the SQL fun.
Pre-requisite for this tutorial: Get start with TiDB - Setup a sandbox in 5 minutes
You will run all the following commands in the mysql client.
Create a database for customer data:
Create database customerDB;
Switch to the new customer database:
Use customerDB;
Create a customer table that contains basic customer information:
Create table customer(
id integer NOT NULL PRIMARY KEY,
firstname varchar (255),
lastname varchar (255),
username varchar (255),
membership varchar (255)
);
Insert some data into the new table:
Insert into customer (id,firstname, lastname, username, membership)
values (1,'Maria', 'Clarke', 'mclark','RPEMIUM'),
(2,'Terrence', 'Walker', 'twalker', 'STANDARD'),
(3,'Charles', 'Bing','cbing','FREE'),
(4,'Ray', 'Smiths', 'rsmiths', 'FREE'),
(5,'Rhonda', 'Clarke', 'rclarke', 'PREMIUM');
Run some very very very basic queries
Select count(*) from customer;
Select username from customer where membership = 'FREE';
That’s it! Worked as any SQL database. In the next tutorial, we will run an application use TiDB as the database engine.