Azure Databricks - [02] 常用SQL

查看当前所在catalog:select current_catalog();

创建catalog:create catalog if not exists harley_test;

创建表

create table if not exists lakehouse_sit.default.harley_overtime
(
  id int comment '序号',
  type int comment '1:加班,0:调休',
  overtime_date string  comment '加班/调休日期',
  overtime_hours double comment '加班时长(单位:小时)'
)

插入数据

insert into lakehouse_sit.default.harley_overtime values (1,1,'20241203',5);

查看建表语句

show create table lakehouse_sit.default.harley_overtime;

查看表结构:desc lakehouse_sit.default.harley_overtime;

修改字段注释:

alter table lakehouse_sit.default.harley_overtime alter column overtime_hours comment '加班/调休时长(单位:小时)';

添加字段:

alter table lakehouse_sit.default.harley_overtime add column comment_msg string comment '备注';

删除字段:

alter table lakehouse_sit.default.harley_overtime drop column comment_msg;

 

posted @ 2024-12-20 11:17  HOUHUILIN  阅读(51)  评论(0)    收藏  举报