The common operation of MySQL here first to do a summary, has been integrated into the code, after the inspection is correct.
Copy Code code as follows:
/* Create a database/*
Create Database xuning_test;
/* Description of using Database object at that time/*
Use Xuning_test;
/* Add tables to the database and define the structure of the table * *
CREATE TABLE Person (
ID int NOT NULL,
Name varchar NOT NULL,
Sex varchar () NOT NULL,
Age int is not NULL,
Address varchar (128) is not NULL,
Remark varchar () NOT NULL
);
/* Insert data into the table in the database/*
INSERT INTO person value
(1, ' name_1 ', ' Men ',}, ' Beijing ', ' This is a frindsheep boy '),
(2, ' name_2 ', ' Men ', ' Shanghai ', ' OK Great '),
(1, ' name_3 ', ' man ', +, ' Guangzhou ', ' This is lickly '),
(1, ' name_4 ', ' Men ', $, ' Beijing ', ' This is a frindsheep boy '),
(1, ' name_5 ', ' Men ', ' Beijing ', ' you dont going to shool '),
(1, ' name_6 ', ' Man ', ' Beijing ', ' the ' is a Frindsheep boy '),
(1, ' name_7 ', ' Men ', ' Beijing ', ' This is a frindsheep boy '),
(1, ' name_8 ', ' Man ', ' Beijing ', '),
(1, ' name_9 ', ' Men ', one, ' Beijing ', ' This is a frindsheep boy ')
;
/* Query was successfully inserted * *
select * from person;
/* Below is a variety of query methods * *
/* Based on the name attribute value of the column * *
select name from person;
/* Add condition-according to sex * *
Select name from person where sex = ' men ';
/* You can also use the comparator as a condition--a certain comma-separated/
Select name,address from person where age > 50;
/* As object to use database and table relationship =---two-table association--object relationship must be clear/
Select Xuning_test.person.name, Xuning_test.person.id, Xuning_test.person.age, xuning_test.person.address
From Xuning_test.person, test1.test_xuning
where xuning_test.person.id = Test1.test_xuning.id
;
/* Use the alias of the table to inquire * *
Use Xuning_test;
Select C.name,sex from person as C where c.age > and c.address= ' Beijing ';