SQLite3.0语法 语句

2017-11-11  本文已影响10人  漩涡长门
DROP TABLE IF EXISTS 't_student';
CREATE TABLE IF NOT EXISTS 't_student' (

        'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

        'name' TEXT,

        'age' INTEGER

);
INSERT INTO t_student (name, age) VALUES ('name', age);

UPDATE t_student SET age = 30 WHERE name = 'why';

UPDATE t_student SET name = 'zs' WHERE age > 20;
DELETE FROM t_student WHERE name = 'zs’;
SELECT * FROM t_student;2.
SELECT name, age FROM t_student;3.
SELECT name, age FROM t_student WHERE age <= 25;4.
SELECT name, age FROM t_student WHERE name LIKE '%l%';5.
SELECT name, age FROM t_student WHERE name LIKE '%l%' AND age >=25;

SELECT name, age FROM t_student WHERE name LIKE '%l%' OR age >=25;
SELECT count(*) FROM t_student;SELECT count(name) FROM t_student;SELECT count(age) FROM t_student;
SELECT * FROM t_student ORDER BY age;
SELECT * FROM t_student ORDER BY age DESC;
SELECT * FROM t_student ORDER BY age, name DESC;
SELECT [s.name](http://s.name "Page 2")
, s.age FROM t_student AS s;
SELECT name AS myName, age AS myAge FROM t_student;
SELECT name, age FROM t_student LIMIT 4, 2;2>
SELECT name, age FROM t_student LIMIT 5;
上一篇 下一篇

猜你喜欢

热点阅读