openGauss下的操作指令【华为根技术】

测试智商的网站 9小时前 阅读数 2184 #软件测试

1、创建一张表 products

字段名 数据类型 含义
product_id integer 产品编号
product_name char(30) 产品名
category char(20) 种类

----建表语句

create table products
( product_id integer,
product_name char(30),
category char(20)
) ;

----查看表的结构
omm=# \d products

2、向表中插入数据,分别采用一次插入一条和一次插入多条记录的方式

insert into products(product_id,product_name,category) values (1502, ‘olympus camera’, ‘electrncs’);

insert into products(product_id,product_name,category) values

(1601,‘lamaze’,‘toys’),
(1700,‘wait interface’,‘Books’),
(1666,‘harry potter’,‘toys’);



3、查询表中所有记录及记录数

select count(*) from products;

select * from products;

4、查询表中所有category记录,并将查询结果按升序排序

select category from products order by category asc;

5、查询表中category为toys的记录

select * from products where category = ‘toys’;

6、更改表中某个字段的值

update products set product_name=‘camera’ where product_id=1502;
select * from products;

6、删除表products

drop table products;

select * from products;

总结

openGauss数据库作为一款基于SQL标准的关系型数据库管理系统,支持广泛的SQL指令进行数据操作、查询、管理以及权限控制。OpenGauss提供面向多核的极致性能、全链路的业务和数据安全、基于AI的调优和高效运维的能力让我受益匪浅。尤其是OpenGauss在AI自治方面的能力真是令人惊喜。自调优、自诊断自愈、自组装这三大自治简直是所有dba的福音。

openGauss下的操作指令【华为根技术】

  • 随机文章
  • 热门文章
  • 热评文章
热门