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 @   HOUHUILIN  阅读(16)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示