随笔分类 -  SQL

摘要:open dbcollection=pymongo.Connection('localhost',27017).job.listinsert datacollections.insert(document)Updatefrom bson.objectid importObjectIdcollection.update("_id":ObjectId('fwefewf34234'),{"$set":{'lastTime':'12}}) 阅读全文
posted @ 2013-11-10 13:31 Epirus 阅读(216) 评论(0) 推荐(0)
摘要:1.CREATE TABLE costlist(id int not null auto_increment primary key,inputtime TIMESTAMP,name varchar( 6 ) ,sum DECIMAL( 4, 1 ) default '0' ,cost DECIMAL(4,1) default '0',balance DECIMAL( 4, 1 ) default '0',information TEXT,flag varchar(1))2.create table user( id smallint auto_ 阅读全文
posted @ 2012-08-17 09:06 Epirus 阅读(310) 评论(0) 推荐(0)
摘要:1.create index index_name table_name(name,id);2.create table table_name( id int not null, name text, price int , primary key(id), key index_name(name) index index_name(price)//save as above key };3.create table bookmark(username varchar(16) not null,bm_URL varchar(256) not null,index(username... 阅读全文
posted @ 2012-07-31 16:45 Epirus 阅读(160) 评论(0) 推荐(0)
摘要:1.数值型 Integer: Float: 2.char char(m): 固定长度字符串,固定几个就是几个,不会多,也不会少,最多255个字节 varchar(m):可变长度字符串,永远是内容加一个字节 3.string text:words blob:binary data like (pic ,rar file); ENUM: all memers is :65525;每次只能用插入一个的值,像星期这种的数据 SET:all members is 64;集合可以插入多个 4.data and tim... 阅读全文
posted @ 2012-07-31 15:26 Epirus 阅读(430) 评论(0) 推荐(0)
摘要:1.create table table_name(var1 type1,var2 type2)CREATE TABLE Persons( Id_P int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) )create table if not exists table_name(same ....);2.desc table_name //to see the structure of table3.delete from table_name where ... 阅读全文
posted @ 2012-07-30 15:03 Epirus 阅读(211) 评论(0) 推荐(0)