Database statement simply finishing

1, create a table

stu on behalf of the table name

sql = "Create table stu(id Integer,sex char,score float )";

  Integer plastic

2, insert data

sql = "insert into stu (sex, score) values ​​( 'man', 98)"; // data insertion portion

sql = "insert into stu values(1,'man',99)"

3, update data

sql = "update stu set score = 99 where id = 1";

sql = "update stu set score = 99 ,sex = woman where id = 1";

4, query data

sql = "select * from stu"; // All inquiries

sql = "select * from stu limit 100"; // Query the last 100 entries

sql = "select * from stu where id = 1"; // query by the conditions, here is a query sentence with id 1

sql = "select id from stu"; // query id data of this column

5, delete statement

sql = "delete from stu where id = 1"; // delete the row with id 1

sql = "delete from stu"; // delete the entire table data

6, an increase in the table

sql = "alter table stu add column address char"; // address this increase are given in Table

7, delete the table

sql = "drop table stu";

Guess you like

Origin www.cnblogs.com/caozewen/p/12173865.html