表 table的结构如下: id title 1 12,21 2 21,32 3 45,21,78 4 221,45,74 5 34,421,121 6 52,21,321 现在用sql语句查出来字段里包含21的所有记录怎么办? select * from table where title=21 or title like ’%,21’ or title like ’%,21,%’ or title like ’21,%’ 这样查看看有问题吗? 肯定这样会把421 221 这样信息查出来的!
/*以下代码是对emp表/dept表/salgrade表进行显示宽度设置 */col empno for 9999;col ename for a10;col job for a10;col mgr for 9999;col hiredate for a12;col sal for 9999;col comm for 9999;col deptno for 99;col dname for a14;col loc for a14;col grade for 9999;col tname for
/*--以下代码是对emp表进行显示宽度设置col empno for 9999;col ename for a10;col job for a10;col mgr for 9999; col hiredate for a12;col sal for 9999;col comm for 9999;col deptno for 99;set pagesize 20; --创建新表new_emp,复制emp表中的结构和数据到new_emp表中create table xxx as select *
import sqlite3 conn = sqlite3.connect('/tmp/sqlite.db') cur = conn.cursor() 接下来干嘛呢?建一张表吧.这里需要注意的是,SQLite不支持在创建表的同时创建索引,所以要分两步走,先创建表然后再创建索引 create_table_stmt = '''CREATE TABLE IF NOT EXISTS test_table ( id INTEGER PRIMARY KEY AUTOINCREMENT, duration I