This topic describes how to use MaxCompute to analyze data concerning house buyers with bank loans. After you purchase a MaxCompute project with your Alibaba Cloud account, you are added to the project and authorized to create a table. Afterwards, you can complete client configurations on your local PC and operate MaxCompute.
The MaxCompute quick start guide describes how to use the Install and configure the MaxCompute client and MaxCompute Studio to create tables and how to upload, process, and export data. Alternatively, you can use DataWorks to perform these operations. For more information, see DataWorks quick start.
- Run common commands on the MaxCompute client.
- Follow the instructions provided in Visualization of operating the tables to use MaxCompute Studio.
- Follow the instructions provided in Manage tables to use DataWorks.
Create a table
CREATE TABLE [IF NOT EXISTS] table_name
[(col_name data_type [COMMENT col_comment], ...)]
[COMMENT table_comment]
[PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)]
[LIFECYCLE days]
[AS select_statement]
CREATE TABLE [IF NOT EXISTS] table_name
LIKE existing_table_name
After logging on to the MaxCompute client, you need to confirm that you are in the
correct project. In this example, the project name is MaxCompute_DOC, so you can run
use MaxCompute_DOC;
to switch to the project.
In this example, the bank_data table is used to store service data, and the result_table table is used to store data processing results.
CREATE TABLE IF NOT EXISTS bank_data
(
age BIGINT COMMENT 'age',
job STRING COMMENT 'job type',
marital STRING COMMENT 'marital status',
education STRING COMMENT 'educational level',
default STRING COMMENT 'credit card ownship',
housing STRING COMMENT 'mortgate',
loan STRING COMMENT 'loan',
contact STRING COMMENT 'contact information',
month STRING COMMENT 'month',
day_of_week STRING COMMENT 'day of the week',
duration STRING COMMENT 'Duration',
campaign BIGINT COMMENT 'contact times during the campaign',
pdays DOUBLE COMMENT 'time interval from the last contact',
previous DOUBLE COMMENT 'previous contact times before this activity',
poutcome STRING COMMENT 'market activity results before this activity',
emp_var_rate DOUBLE COMMENT 'employment change rate',
cons_price_idx DOUBLE COMMENT 'consumer price index',
cons_conf_idx DOUBLE COMMENT 'consumer confidence index',
euribor3m DOUBLE COMMENT 'euro deposit rate',
nr_employed DOUBLE COMMENT 'number of employees',
y BIGINT COMMENT 'whether a fixed deposit holder'
);
The command output OK is displayed, as shown in the following figure.
CREATE TABLE IF NOT EXISTS result_table
(
education STRING COMMENT 'education level',
num BIGINT COMMENT 'number of people'
);
View a table
Run desc <table_name>;
to view information related to a table.
For example, you can run desc bank_data;
to view information related to the bank_data table that was created in the previous step.

For more information, see Table operations.
(Optional) Create a partition
The table used in this example is a non-partition table.
alter table table_name add [if not exists] partition partition(partition_col1 = partition_col_value1, partition_col2 = partiton_col_value2, ...);
You do not need to create an independent partition for different operations, such
as data integration and insert operations.(Optional) Delete a partition
alter table table_name drop [if exists] partition(partition_col1 = partition_col_value1, partition_col2 = partiton_col_value2, ...);
20180923
and region of hangzhou
, run the following command: alter table user drop if exists partition(region='hangzhou',dt='20180923');
(Optional) Delete a table
DROP TABLE [IF EXISTS] table_name;
For more information, see Table operations.
What to do next
You can refer to Import data for data processing.