欢迎投稿

今日深度:

Postgres SQL学习笔记,postgres学习笔记

Postgres SQL学习笔记,postgres学习笔记


1、创建表,添加,查询

create table StuInfo
(
   StuId  SERIAL primary key,-- 自动增长列
   StuName varchar(20),
   Birthday Date,
   StuPhone  varchar(11)
)

insert into StuInfo(StuName,Birthday,StuPhone) values('张三',NOW(),'12345678911') -- 添加   SQLite获取系统时间datetime('now') 

select * from StuInfo -- 查询

 2、查询表的所有字段

select a.attname from pg_class as c,pg_attribute as a where c.relname='tablename' and a.attrelid=c.oid and a.attnum>0

 3、修改字段名

ALTER TABLE public.ss_db_table RENAME "DT_Name" TO dt_name;

 

www.htsjk.Com true http://www.htsjk.com/postgresSQL/10421.html NewsArticle Postgres SQL学习笔记,postgres学习笔记 1、创建表,添加,查询 create table StuInfo( StuId SERIAL primary key , -- 自动增长列 StuName varchar ( 20 ), Birthday Date, StuPhone varchar ( 11 )) insert into StuInfo(StuName,Birt...
相关文章
    暂无相关文章
评论暂时关闭