zoukankan      html  css  js  c++  java
  • PostgreSQL 常用语句

    postgres=# create database mydb;
    CREATE DATABASE
    
    
    postgres=# alter database mydb;
    ALTER DATABASE
    
    
    postgres=# create table mydbtable(name varchar(80),year int);
    CREATE TABLE
    
    
    postgres=# create table mydbtable(name varchar(80),year int);
    ERROR:  relation "mydbtable" already exists
    
    
    postgres=# insert into mydbtable (name,year) values ('xiaoming',23);
    INSERT 0 1
    
    
    postgres=# table mydbtable;
       name   | year 
    ----------+------
     xiaoming |   23
    (1 row)
    
    
    postgres=# select * from mydbtable;
       name   | year 
    ----------+------
     xiaoming |   23
    (1 row)
    
    
    
    postgres=# select name from mydbtable;
       name   
    ----------
     xiaoming
    (1 row)
    
    
    
    postgres=# insert into mydbtable (name,year) values ('xiaohong',23);
    INSERT 0 1
    postgres=# select name from mydbtable;
       name   
    ----------
     xiaoming
     xiaohong
    (2 rows)
    
    
    
    postgres=# update mydbtable set name = 'xiaohei' where name='xiaohong';
    UPDATE 1
    postgres=# select name from mydbtable;
       name   
    ----------
     xiaoming
     xiaohei
    (2 rows)
    postgres=# 
    
    
    postgres=# delete from mydbtable where name='xiaohei';
    DELETE 1
    postgres=# select name from mydbtable;
       name   
    ----------
     xiaoming
    (1 row)
    
    
    postgres=# delete from mydbtable;
    DELETE 1
    postgres=# select * from mydbtable;
     name | year 
    ------+------
    (0 rows)
    postgres=# 
    
    
    postgres=# create database testdb;
    CREATE DATABASE
    
    
    postgres=# alter database testdb;
    ALTER DATABASE

  • 相关阅读:
    js正则表达式大全(2)
    Magic Trackpad 2 on win10 x64
    Google 日历短信通知没有了
    Ueditor 1.4.3 jsp utf-8版Bug修复
    [转]eclipse中build workspace的相关优化
    Hello,
    EpCloud开发日志
    为服务创建安装程序
    winform 通过WCF上传Dataset数据
    opcrcw.da.dll 和.net 4.0
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11197772.html
Copyright © 2011-2022 走看看