返回顶部
首页 > 资讯 > 精选 >Hive数据定义语言DDL有哪些
  • 956
分享到

Hive数据定义语言DDL有哪些

2023-06-03 00:06:17 956人浏览 独家记忆
摘要

这篇文章给大家分享的是有关Hive数据定义语言DDL有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。一、数据库相关操作(DATABASE)    1.1  创建数据库(creat

这篇文章给大家分享的是有关Hive数据定义语言DDL有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。



一、数据库相关操作(DATABASE)
    1.1  创建数据库(create)
        CREATE DATABASE [IF NOT EXISTS] database_name
        [COMMENT database_comment]
        [LOCATioN hdfs_path]
        [WITH DBPROPERTIES (property_name=property_value, ...)];
        默认地址:/user/hive/warehouse/db_name.db/table_name/partition_name/…

    1.2  使用数据库(use)
        USE database_name;
        注意:只有use时不用写DATABASE关键字
    1.3  删除数据库(drop)
        DROP DATABASE [IF EXISTS] database_name [RESTRICT|CASCADE];

    1.4  修改数据库(alter)
        1.4.1  修改数据库属性
                ALTER DATABASE database_name SET DBPROPERTIES (property_name=property_value, …);
        1.4.2  修改数据库所有者
                ALTER DATABASE database_name SET OWNER [USER|ROLE] user_or_role;

二、新建和删除数据表(Create/Drop/Truncate Table)
    2.1 创建数据表(create)
         # 手动建表
        CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name    -- (Note: TEMPORARY available in Hive 0.14.0 and later)
          [(col_name data_type [COMMENT col_comment], ...)]
          [COMMENT table_comment]
          [PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)]
          [CLUSTERED BY (col_name, col_name, ...) [SORTED BY (col_name [ASC|DESC], ...)] INTO num_buckets BUCKETS]
          [SKEWED BY (col_name, col_name, ...)                  -- (Note: Available in Hive 0.10.0 and later)]
             ON ((col_value, col_value, ...), (col_value, col_value, ...), ...)
             [STORED AS DIRECTORIES]
          [
           [ROW FORMAT row_format] 
           [STORED AS file_format]
             | STORED BY 'storage.handler.class.name' [WITH SERDEPROPERTIES (...)]  -- (Note: Available in Hive 0.6.0 and later)
          ]
          [LOCATION hdfs_path]
          [TBLPROPERTIES (property_name=property_value, ...)]   -- (Note: Available in Hive 0.6.0 and later)
          [AS select_statement];   -- (Note: Available in Hive 0.5.0 and later; not supported for external tables)


        # 复制表结构
        CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name
          LIKE existing_table_or_view_name
          [LOCATION hdfs_path];


        #数据类型
        data_type
          : primitive_type
          | array_type
          | map_type
          | struct_type
          | uNIOn_type  -- (Note: Available in Hive 0.7.0 and later)

        primitive_type
          : TINYINT
          | SMALLINT
          | INT
          | BIGINT
          | BOOLEAN
          | FLOAT
          | DOUBLE
          | STRING
          | BINARY      -- (Note: Available in Hive 0.8.0 and later)
          | TIMESTAMP   -- (Note: Available in Hive 0.8.0 and later)
          | DECIMAL     -- (Note: Available in Hive 0.11.0 and later)
          | DECIMAL(precision, scale)  -- (Note: Available in Hive 0.13.0 and later)
          | DATE        -- (Note: Available in Hive 0.12.0 and later)
          | VARCHAR     -- (Note: Available in Hive 0.12.0 and later)
          | CHAR        -- (Note: Available in Hive 0.13.0 and later)

        array_type
          : ARRAY < data_type >

        map_type
          : MAP < primitive_type, data_type >

        struct_type
          : STRUCT < col_name : data_type [COMMENT col_comment], ...>

        union_type
           : UNIONTYPE < data_type, data_type, ... >  -- (Note: Available in Hive 0.7.0 and later)

        # 行列分隔符 
        row_format
          : DELIMITED [FIELDS TERMINATED BY char [ESCAPED BY char]] [COLLECTION ITEMS TERMINATED BY char]
                [MAP KEYS TERMINATED BY char] [LINES TERMINATED BY char]
                [NULL DEFINED AS char]   -- (Note: Available in Hive 0.13 and later)
          | SERDE serde_name [WITH SERDEPROPERTIES (property_name=property_value, property_name=property_value, ...)]


        # 文件存储格式 
        file_format:
          : SEQUENCEFILE
          | TEXTFILE    -- (Default, depending on hive.default.fileformat configuration)
          | RCFILE      -- (Note: Available in Hive 0.6.0 and later)
          | ORC         -- (Note: Available in Hive 0.11.0 and later)
          | PARQUET     -- (Note: Available in Hive 0.13.0 and later)
          | AVRO        -- (Note: Available in Hive 0.14.0 and later)
          | INPUTFORMAT input_format_classname OUTPUTFORMAT output_format_classname


        2.1.1 行格式,文件存储格式,SerDe
                ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\001’ STORED AS SEQUENCEFILE; 
                ROW FORMAT SERDE … STORED AS SEQUENCEFILE;

                RegEx SerDe
                CREATE TABLE apachelog (
                  host STRING,
                  identity STRING,
                  user STRING,
                  time STRING,
                  request STRING,
                  status STRING,
                  size STRING,
                  referer STRING,
                  agent STRING)
                ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
                WITH SERDEPROPERTIES (
                  "input.regex" = "([^]*) ([^]*) ([^]*) (-|\\[^\\]*\\]) ([^ \"]*|\"[^\"]*\") (-|[0-9]*) (-|[0-9]*)(?: ([^ \"]*|\".*\") ([^ \"]*|\".*\"))?"
                )
                STORED AS TEXTFILE;

                2.1.2 分区表(partitioned by)
                CREATE TABLE page_view(
                                 viewTime INT
                                ,userid BIGINT
                                ,page_url STRING
                                ,referrer_url STRING
                                ,ip STRING COMMENT 'IP Address of the User'
                )
                 COMMENT 'This is the page view table'
                 PARTITIONED BY(dt STRING, country STRING)
                 ROW FORMAT DELIMITED
                  FIELDS TERMINATED BY '\001'
                STORED AS SEQUENCEFILE;


                2.1.3 外部表(external)
                可以自定义HDFS存储地址,drop表时数据不删除,还是要指定分隔符的
                CREATE EXTERNAL TABLE page_view(
                                viewTime INT
                                ,userid BIGINT
                                ,page_url STRING
                                , referrer_url STRING
                                ,ip STRING COMMENT 'IP Address of the User'
                                ,country STRING COMMENT 'country of origination'
                )
                 COMMENT 'This is the staging page view table'
                 ROW FORMAT DELIMITED FIELDS TERMINATED BY '\054'
                 STORED AS TEXTFILE
                 LOCATION '<hdfs_location>';


                2.1.4 利用查询结果建表(Create Table As Select (CTAS))
                根据查询结果的列和列类型建表,可以自己指定列分隔符和文件存储格式
                CREATE TABLE new_key_value_store
                   ROW FORMAT SERDE "org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe"
                   STORED AS RCFile
                   AS
                SELECT
                                 (key % 1024) new_key
                                , concat(key, value) key_value_pair
                FROM key_value_store
                SORT BY new_key, key_value_pair;

                2.1.5 复制已有表结构(Create Table Like)
                复制已有表的表结构,不复制数据(属性一样,仅表名不同)
                CREATE TABLE empty_key_value_store
                LIKE key_value_store;

                2.1.6 分桶排序的表(Bucketed Sorted Tables)
                CREATE TABLE page_view(
                 viewTime INTviewTime INT
                ,userid BIGINT
                ,page_url STRING
                ,referrer_url STRING
                ,ip STRING COMMENT 'IP Address of the User'
                ,ip STRING COMMENT 'IP Address of the User'
                )
                 COMMENT 'This is the page view table'
                 PARTITIONED BY(dt STRING, country STRING)
                 CLUSTERED BY(userid) SORTED BY(viewTime) INTO 32 BUCKETS
                 ROW FORMAT DELIMITED
                   FIELDS TERMINATED BY '\001'
                   COLLECTION ITEMS TERMINATED BY '\002'
                   MAP KEYS TERMINATED BY '\003'
                 STORED AS SEQUENCEFILE;
                上表按userid分桶,桶内按viewTime升序排列,可以更有效的取样和让内部操作更加了解数据结构,从而提高运算性能。
                建表时的CLUSTERED BY和SORTED BY语句只对数据读取有作用,对写入没有作用,所以在写入数据时需要手动指定reduce数等于分桶数并且使用CLUSTERED BY和SORTED BY语句。
                简便方法是set hive.enforce.bucketing = true;这样写入数据时就不用那么麻烦了,系统将会自动指定reduce数等于分桶数和使用CLUSTERED BY和SORTED BY语句。分桶规则依赖于hash函数。
                例如:建表语句
                CREATE TABLE user_info_bucketed(
                 user_id BIGINT
                ,firstname STRING
                ,lastname STRING
                )
                COMMENT 'A bucketed copy of user_info'
                PARTITIONED BY(ds STRING)
                CLUSTERED BY(user_id) INTO 256 BUCKETS;
                插入语句:
                set hive.enforce.bucketing = true; 
                FROM user_id
                INSERT OVERWRITE TABLE user_info_bucketed
                PARTITION (ds='2009-02-25')
                SELECT userid, firstname, lastname WHERE ds='2009-02-25';

                2.1.7 倾斜表(Skewed Tables)
                某列的几个值出现频率非常高,所以相比于其它值他们的运算非常慢,造成倾斜,Hive可以指定将特定的值单独存储到独立文件中来提高性能。 
                单列举例:
                CREATE TABLE list_bucket_single (key STRING, value STRING)
                 SKEWED BY (key) ON (1,5,6) [STORED AS DIRECTORIES];
                多列举例:
                CREATE TABLE list_bucket_multiple (col1 STRING, col2 int, col3 STRING)
                  SKEWED BY (col1, col2) ON (('s1',1), ('s3',3), ('s13',13), ('s78',78)) [STORED AS DIRECTORIES];

                2.1.8 临时表(Temporary Tables)
                临时表仅这个session可见,存储在用户临时目录,session结束后删除。
                如果与永久表重名,则查询时默认为临时表,直到不重名或者删除临时表。

        2.2 删除数据表(drop)
                删除外表不删数据
                删除内表数据移到用户垃圾箱(可以重建metadata并移回数据来恢复)
                指定PURGE强制删除不可恢复
                DROP TABLE [IF EXISTS] table_name [PURGE];

        2.3 清空数据表(Truncate Table)
                清空表数据,指定partition时只清空特定partition的数据。
                TRUNCATE TABLE table_name [PARTITION (partition_column = partition_col_value, partition_column = partition_col_value, ...)];

三、修改数据表(Alter Table/Partition/Column)
        3.1 修改表(Alter Table)

                3.1.1 重命名表(Rename Table)
                ALTER TABLE table_name RENAME TO new_table_name;

                3.1.2 修改表属性(Alter Table Properties)
                ALTER TABLE table_name SET TBLPROPERTIES (property_name = property_value, property_name = property_value, ... );

                3.1.3 修改表注释(Alter Table Comment)
                ALTER TABLE table_name SET TBLPROPERTIES ('comment' = new_comment);

                3.1.4 修改SerDe属性(Add SerDe Properties)
                ALTER TABLE table_name [PARTITION partition_spec] SET SERDE serde_class_name [WITH SERDEPROPERTIES (property_name = property_value, property_name = property_value, ... )];
                ALTER TABLE table_name [PARTITION partition_spec] SET SERDEPROPERTIES (property_name = property_value, property_name = property_value, ... );
                属性的名和值都需要加引号
                ALTER TABLE table_name SET SERDEPROPERTIES ('field.delim' = ',');

                3.1.5 修改表存储属性(Alter Table Storage Properties)
                ALTER TABLE table_name CLUSTERED BY (col_name, col_name, ...) [SORTED BY (col_name, ...)]
  INTO num_buckets BUCKETS;
                只修改metadata,用户需要自己确保实际数据的格式与改完后的metadata相符

                3.1.6 修改倾斜表属性(Alter Table Skewed or Stored as Directories)
                改为倾斜表
                ALTER TABLE table_name SKEWED BY (col_name1, col_name2, ...)
  ON ([(col_name1_value, col_name2_value, ...) [, (col_name1_value, col_name2_value), ...]
  [STORED AS DIRECTORIES];
                改为非倾斜表
                ALTER TABLE table_name NOT SKEWED;
                改为不单独存储倾斜列
                ALTER TABLE table_name NOT STORED AS DIRECTORIES;
                修改倾斜表位置
                ALTER TABLE table_name SET SKEWED LOCATION (col_name1="location1" [, col_name2="location2", ...] );

        3.2 修改分区(Alter Partition)

                3.2.1 增加分区(Add Partitions)
                ALTER TABLE table_name ADD [IF NOT EXISTS] PARTITION partition_spec 
  [LOCATION 'location1'] partition_spec [LOCATION 'location2'] ...;
                partition_spec:
                  : (partition_column = partition_col_value, partition_column = partition_col_value, ...)
                修改分区仅修改metadata,实际数据需要用户自己修改

                3.2.2 动态分区(Dynamic Partitions)

                3.2.3 重命名分区(Rename Partition)
                ALTER TABLE table_name PARTITION partition_spec RENAME TO PARTITION partition_spec;
                相当于更改了分区对应的那个列的值

                3.2.4 交换分区(Exchange Partition)
                ALTER TABLE table_name_1 EXCHANGE PARTITION (partition_spec) WITH TABLE table_name_2;
                -- multiple partitions
                ALTER TABLE table_name_1 EXCHANGE PARTITION (partition_spec, partition_spec2, ...) WITH TABLE table_name_2;
                将分区从一个表迁移到另一个表,要求两个表结构一致且目标表没有这个分区

                3.2.5 修复分区(MSCK REPAIR TABLE)
                当我们手动传数据到hdfs作为一个分区时需要在metadata进行设置以便能够识别
                MSCK REPAIR TABLE table_name;

                3.2.6 删除分区(Drop Partitions)
                ALTER TABLE table_name DROP [IF EXISTS] PARTITION partition_spec[, PARTITION partition_spec, ...]
                  [IGNORE PROTECTION] [PURGE];
                删除分区时同时删除metadata和data,删除的data到用户垃圾箱

        3.3 修改表或者分区(Alter Either Table or Partition)

                3.3.1 修改文件格式(Alter Table/Partition File Format)
                ALTER TABLE table_name [PARTITION partition_spec] SET FILEFORMAT file_format;

                3.3.2 修改存储位置(Alter Table/Partition Location)
                ALTER TABLE table_name [PARTITION partition_spec] SET LOCATION "new location";

        3.4 修改列(Alter Column)
                列名是大小写敏感的

                3.4.1 修改列名/数据类型/位置/注释(Change Column Name/Type/Position/Comment)
                ALTER TABLE table_name [PARTITION partition_spec] CHANGE [COLUMN] col_old_name col_new_name column_type
  [COMMENT col_comment] [FIRST|AFTER column_name] [CASCADE|RESTRICT];
                例子:
                CREATE TABLE test_change (a int, b int, c int);

                # First change column a's name to a1.
                ALTER TABLE test_change CHANGE a a1 INT;


                # Next change column a1's name to a2, its data type to string, and put it after column b.
                ALTER TABLE test_change CHANGE a1 a2 STRING AFTER b;
                # The new table's structure is:  b int, a2 string, c int.


                # Then change column c's name to c1, and put it as the first column.
                ALTER TABLE test_change CHANGE c c1 INT FIRST;
                # The new table's structure is:  c1 int, b int, a2 string.


                # Add a comment to column a1
                ALTER TABLE test_change CHANGE a1 a1 INT COMMENT 'this is column a1';

                3.4.2 添加列(Add Columns)
                ALTER TABLE table_name 
                  [PARTITION partition_spec]                 
                  ADD COLUMNS (col_name data_type [COMMENT col_comment], ...)
                  [CASCADE|RESTRICT]   
                添加的列位于普通列最后位置,在分区列之前

四、视图的相关操作(Create/Drop/Alter View)
        4.1 创建视图(Create View)
                CREATE VIEW [IF NOT EXISTS] [db_name.]view_name [(column_name [COMMENT column_comment], ...) ]
                  [COMMENT view_comment]
                  [TBLPROPERTIES (property_name = property_value, ...)]
                  AS SELECT ...;
                视图仅是逻辑对象,不是实际存储,查询时相当于先查出视图再进一步查询
                不指定列名时按select的列来算
                一旦创建即被冻结,表再变化不会影响视图变化
                只读不能插入数据
                SHOW CREATE TABLE 用来查看建视图的语句
                例子:
                CREATE VIEW onion_referrers(url COMMENT 'URL of Referring page')
                  COMMENT 'Referrers to The Onion WEBsite'
                  AS
                  SELECT DISTINCT referrer_url
                  FROM page_view
                  WHERE page_url='Http://www.theonion.com';

        4.2 删除视图(Drop View)
                DROP VIEW [IF EXISTS] view_name;
                例子:
                DROP VIEW onion_referrers;

        4.3 修改视图属性(Alter View Properties)
                ALTER VIEW view_name SET TBLPROPERTIES table_properties;
                table_properties:
                : (property_name = property_value, property_name = property_value, ...)

        4.4 修改已有视图(Alter View As Select)
                ALTER VIEW view_name AS select_statement;
                只能用于没有分区的视图

五、索引的相关操作
        5.1 创建索引(Create Index)
                    CREATE INDEX index_name
                ON TABLE base_table_name (col_name, ...)
                  AS index_type
                  [WITH DEFERRED REBUILD]
                  [IDXPROPERTIES (property_name=property_value, ...)]
                  [IN TABLE index_table_name]
                  [
                     [ ROW FORMAT ...] STORED AS ...
                     | STORED BY ...
                  ]
                  [LOCATION hdfs_path]
                  [TBLPROPERTIES (...)]
                  [COMMENT "index comment"];

        5.2 删除索引(Drop Index)
                DROP INDEX [IF EXISTS] index_name ON table_name;

                5.3 修改索引(ALTER INDEX)
                ALTER INDEX index_name ON table_name [PARTITION partition_spec] REBUILD;

六、方法的相关操作(Create/Drop/Reload Function)
        6.1 临时方法(Temporary Functions)

                6.1.1 创建临时方法(Create Temporary Function)
                CREATE TEMPORARY FUNCTION function_name AS class_name;
                利用类名创建临时方法,在当前session有效,类名可以先add jar

                6.1.2 删除临时方法(DROP TEMPORARY FUNCTION)
                DROP TEMPORARY FUNCTION [IF EXISTS] function_name;

        6.2 永久方法(Permanent Functions)

                6.2.1 创建永久方法(Create Function)
                CREATE FUNCTION [db_name.]function_name AS class_name
                  [USING JAR|FILE|ARCHIVE 'file_uri' [, JAR|FILE|ARCHIVE 'file_uri'] ];
                需要限制到数据库,如果没有写数据库,默认当前数据库 
                需要先添加进去并用using访问

                6.2.2 删除永久方法(DROP FUNCTION)
                DROP FUNCTION [IF EXISTS] function_name;

                6.2.3 重载永久方法(RELOAD FUNCTION)
                RELOAD FUNCTION;

七、用户权限相关操作(Create/Drop/Grant/Revoke Roles and Privileges)

八、查看相关信息(Show)
        8.1 查看数据库(Show Databases)
                SHOW (DATABASES|SCHEMAS) [LIKE 'identifier_with_wildcards'];
                用”*”表示任意个字符,”|”表示或

        8.2 查看表/分区/索引(Show Tables/Partitions/Indexes)

                8.2.1 查看表(Show Tables)
                SHOW TABLES [IN database_name] [like 'identifier_with_wildcards'];
                in语句表示数据库,不写默认当前数据库 
                用”*”表示任意个字符,”|”表示或

                8.2.2 查看分区(Show Partitions)
                SHOW PARTITIONS table_name;
                也可以指定分区中的一个或几个字段
                SHOW PARTITIONS table_name PARTITION(ds='2010-03-03');
                SHOW PARTITIONS table_name PARTITION(hr='12');
                SHOW PARTITIONS table_name PARTITION(ds='2010-03-03', hr='12');

                8.2.3 查看表和分区的扩展信息(Show Table/Partition Extended)
                SHOW TABLE EXTENDED [IN|FROM database_name] LIKE 'identifier_with_wildcards' [PARTITION(partition_spec)];
                extended会给出表的文件信息和文件大小、修改时间等信息 
                如果指定了partition就不能用表的正则匹配了,只能指定具体的表

                8.2.4 查看表属性(Show Table Properties)
                SHOW TBLPROPERTIES tblname;
                SHOW TBLPROPERTIES tblname("foo");
                第一种方式给出表的所有属性值 
                第二种方式给出表的指定的属性值

                8.2.5 查看表的创建信息(Show Create Table)
                SHOW CREATE TABLE ([db_name.]table_name|view_name);
                既能看table,也能看view

                8.2.6 查看索引(Show Indexes)
                SHOW [FORMATTED] (INDEX|INDEXES) ON table_with_index [(FROM|IN) db_name];

        8.3 查看列(Show Columns)
                SHOW COLUMNS (FROM|IN) table_name [(FROM|IN) db_name];

        8.4 查看方法(Show Functions)
                SHOW FUNCTIONS "a.*";
                查看所有方法时用”.*”

        8.5 查看用户和权限(Show Granted Roles and Privileges)

        8.6 查看(Show Locks)
                SHOW LOCKS <table_name>;
                SHOW LOCKS <table_name> EXTENDED;
                SHOW LOCKS <table_name> PARTITION (<partition_spec>);
                SHOW LOCKS <table_name> PARTITION (<partition_spec>) EXTENDED;
                SHOW LOCKS <DATABASE> database_name;

        8.7 查看配置信息(Show Conf)
                SHOW CONF <configuration_name>;
                不会列出当前配置的值,如果需要请使用set命令

        8.8 查看事务信息(SHOW TRANSACTIONS)
                SHOW TRANSACTIONS;
        8.9 查看压缩信息(SHOW COMPACTIONS)
                SHOW COMPACTIONS;

九、描述相关信息(Describe)
        9.1 描述数据库(Describe Database)
                DESCRIBE DATABASE [EXTENDED] db_name;
                extended给出数据库的属性信息

        9.2 描述表/视图/列(Describe Table/View/Column)
                没有指定数据库时
                DESCRIBE [EXTENDED|FORMATTED] 
                  table_name[.col_name ( [.field_name] | [.'$elem$'] | [.'$key$'] | [.'$value$'] )* ];
                指定数据库时
                DESCRIBE [EXTENDED|FORMATTED] 
                  [db_name.]table_name[ col_name ( [.field_name] | [.'$elem$'] | [.'$key$'] | [.'$value$'] )* ];

                9.2.1 展示列的统计信息(Display Column Statistics)
                DESCRIBE FORMATTED [db_name.]table_name column_name;
                DESCRIBE FORMATTED [db_name.]table_name column_name PARTITION (partition_spec);

        9.3 描述分区信息(Describe Partition)
                没有指定数据库时
                DESCRIBE [EXTENDED|FORMATTED] table_name[.column_name] PARTITION partition_spec;
                指定数据库时
                DESCRIBE [EXTENDED|FORMATTED] [db_name.]table_name [column_name] PARTITION partition_spec;
                例子:
                DESCRIBE page_view PARTITION (ds='2008-08-08');

感谢各位的阅读!关于“Hive数据定义语言DDL有哪些”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

--结束END--

本文标题: Hive数据定义语言DDL有哪些

本文链接: https://lsjlt.com/news/231778.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • Hive数据定义语言DDL有哪些
    这篇文章给大家分享的是有关Hive数据定义语言DDL有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。一、数据库相关操作(DATABASE)    1.1  创建数据库(creat...
    99+
    2023-06-03
  • MySQL中DDL数据定义语句有哪些
    小编给大家分享一下MySQL中DDL数据定义语句有哪些,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!一、DDL数据定义语句库的管...
    99+
    2024-04-02
  • MySQL 数据定义语言(DDL)
    SQL 包含以下 4 部分: 1 数据定义语言(DDL):DROP、CREATE、ALTER 等语句。 2 数据操作语言(DML):INSERT(插入)、UPDATE(修改)、DELETE(删除)语句...
    99+
    2017-10-01
    MySQL 数据定义语言(DDL)
  • MySQL之数据定义语言(DDL)
    写在前面 本文中 [ 内容 ] 代表啊可选项,即可写可不写。 SQL语言的基本功能介绍 SQL是一种结构化查询语言,主要有如下几个功能: 数据定义语言(DDL):全称Data Definition Language 数据操纵语言(...
    99+
    2017-12-13
    MySQL之数据定义语言(DDL)
  • MySQL数据定义语言DDL的基础语句
    MySQL DDL 语句 什么是DDL,DML。 DDL 是数据定义语言,就是对数据库,表层面的操作,如 CREATE,ALTER,DROP。DML 是数据操作语言,也就是对表中数据的增删改查,如 SELECT,UP...
    99+
    2022-05-26
    数据定义语言DDL MySQL DDL
  • MySQL总结(三)DDL数据定义语言-详解
    每行语句需要选中后再执行,可以选中后按F9快捷键执行 1.1.2 具体操作 -- 直接创建数据库db1; create database db1; -- 判断数据库是否存在,如果不存在则创建数据库db2; create database...
    99+
    2021-10-12
    MySQL总结(三)DDL数据定义语言-详解
  • MySQL数据库之数据表操作DDL数据定义语言
    目录一、创建数据表二、查询数据表三、 删除数据表四、修改数据表以及字段一、创建数据表 数据表:一个二维的表格,一个表格是由多列组成,表格中的每一类称之为表格的字段 以上述学生信息表格为例在mysql数据库中创建一张表格...
    99+
    2022-08-18
    MySQL数据表操作 MySQL DDL数据定义语言
  • hive常见自定义函数有哪些
    这篇文章主要介绍了hive常见自定义函数有哪些,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。1.1 为什么需要自定义函数hive的内置函数满足不了所有的业务需求。hive提供...
    99+
    2023-06-02
  • MySQL教程数据定义语言DDL示例详解
    目录1.SQL语言的基本功能介绍2.数据定义语言的用途3.数据库的创建和销毁4.数据库表的操作(所有演示都以student表为例)1)创建表2)修改表3)销毁表如果你是刚刚学习MyS...
    99+
    2024-04-02
  • SQL语句中的DDL类型的数据库定义语言操作
    目录SQL语句之DDL类型的数据库定义语言1.DDL类型的SQL语句基本概述2.DDL类型的SQL语句之数据库层面的操作2.1.创建一个数据库2.2.查看mysql中有哪些数据库2.3.进入某个数据库2.4.查看当前处于...
    99+
    2022-08-09
    SQL DDL数据库定义语言 SQL数据库定义语言
  • C语言数组定义的方式有哪些
    C语言数组定义的方式有以下几种:1. 一维数组的定义:```ctype arrayName[arraySize];```例如:```...
    99+
    2023-08-09
    C语言
  • Hive数据类型有哪些
    这篇文章将为大家详细讲解有关Hive数据类型有哪些,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。hive 目前支持的数据类型如下:-- 数值类型 Numeric TypesTINYINT (1-byte ...
    99+
    2023-06-03
  • HIVE有哪些数据类型
    本篇内容主要讲解“HIVE有哪些数据类型”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“HIVE有哪些数据类型”吧!1. 数值型类型后缀例子TINYINTY100YSMALLINTS100SBIG...
    99+
    2023-06-03
  • C语言函数有哪些及怎么定义使用
    本篇内容介绍了“C语言函数有哪些及怎么定义使用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!1、函数是什么?维基百科中对函数的定义:子程序在...
    99+
    2023-06-30
  • Hive的数据类型有哪些
    这篇“Hive数据类型有哪些”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“Hive数据类型有哪些”文章吧。一、Hive介绍h...
    99+
    2023-06-30
  • go语言结构体定义有哪些方法
    go语言结构体定义的方法有:1、直接定义结构体字段;2、使用嵌入结构体;3、定义带有方法的结构体;4、使用指针类型作为结构体字段;5、使用数组或切片作为结构体字段。在Go语言中,可以使用结构体来定义一组相关字段的集合,这些字段可以是基本数据...
    99+
    2023-12-12
    go语言 结构体
  • c语言常量定义的方式有哪些
    整型常量:使用整数直接量定义,如10、-5等。 浮点型常量:使用浮点数直接量定义,如3.14、-0.5等。 字符常量:使用单引号括...
    99+
    2024-03-07
    c语言
  • c语言常量定义的规则有哪些
    整数常量:整数常量可以是十进制、八进制、十六进制或二进制格式的数字,例如10、012、0x1A、0b1010等。 ...
    99+
    2024-03-07
    c语言
  • MySQL基础教程14 —— SQL语法之数据定义语句DDL
    1. ALTER DATABASE语法 ALTER {DATABASE | SCHEMA} [db_name] alter_specification [, alter_specification] ... ...
    99+
    2022-05-17
    DDL MySQL SQL 数据库
  • c语言字符常量定义规则有哪些
    C语言字符常量的定义规则有以下几点: 字符常量由单引号 (' ') 包围,例如 'A'、'b'、'7' 等。 字符常量只能包含一个...
    99+
    2023-10-23
    C语言
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作