ios mysql 创建不同的用户表_iOS中数据库-创建表-增删改查数据-基础语法
什么是SQL:結(jié)構(gòu)化查詢語言。create創(chuàng)建表drop刪除表,delete是刪除表中的數(shù)據(jù)
SQL語句不區(qū)分大小寫,每條語句必須以分號結(jié)束,數(shù)據(jù)庫中不可以使用關(guān)鍵字用為表名(sql常用關(guān)鍵字? select create from。。。。。)
創(chuàng)表格式:
create table if not exists 表名(字段1 字段類型1,字段2 字段類型2,.......);
也可以建表時候不聲明類型:如:create table t_student(name,age);最好是寫類型
例如:create table if not exists 表名 (字段1 字段類型1,字段2 字段類型2,.......);
create table if not exists 表名 (id integer,name text,age integer);
刪除表:drop table if exists 表名;如:drop table if exists t_student;
表中插入數(shù)據(jù)格式:
insert into 表名(字段類型1,字段類型2,........)values(字段1的值,字段2的值,......)
例如:insert into t_student(name,age)values('tom',10);數(shù)據(jù)庫中的字符串內(nèi)容要用單引號括住
網(wǎng)表里面插入數(shù)據(jù),可以不用每項都插入值。
刪除數(shù)據(jù)格式:delete from 表名;如:delete from t_stu;
更新數(shù)據(jù)格式:update 表名 set 字段1=字段1的值,字段2=字段2的值,....;
如:update s_stu set age=10,sex='nan';這句話會把表中的所有age改為10,所有sex改為nan.
查詢表數(shù)據(jù):select *from 表名;//查詢所有字段
select *from t_stu where age>10;//條件查詢
總結(jié)
以上是生活随笔為你收集整理的ios mysql 创建不同的用户表_iOS中数据库-创建表-增删改查数据-基础语法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2g独显gt710显卡怎么样
- 下一篇: linux cmake编译源码,linu