sql中desc的妙用

很多情况下对表内部结构不熟悉,想看下我创建的表里面又多少表明,又想他按照首字母的规律排列,

这时候就要用desc +表名了。

desc t_bike_info;
hive> desc t_bike_info;
OK
guid                	string              	                    
bike_no             	string              	                    
city_guid           	string              	                    
city_name           	string              	                    
produce_time        	string              	                               	                    
produce_batch_number	string              	                    
hardware_type       	int                 	                    
bike_sim            	string              	                    
bike_color          	int                 	                                   	                    
bike_key            	string              	                    
control_person_id   	string              	                               	                    
online_time         	string              	                    
create_date         	string              	                    
update_date         	string              	                    
create_user_guid    	string              	                    
update_user_guid    	string              	                    
test_time           	string              	                                	                    
unqualified_reason  	string              	                    
service_area_id     	string              	                    
service_area_name   	string              	                    
sum_running_distance	int                 	                    
lng                 	double              	                    
lat                 	double              	                    
user_last_point_type	int                 	                    
user_last_point_time	string              	                    
hardware_version    	string              	                    
firmware_version    	string              	                    
city_code           	string              	                    
pt                  	string       

 

 1 hive> desc t_bike_info;
 2 OK
 3 guid                    string                                      
 4 bike_no                 string                                      
 5 city_guid               string                                      
 6 city_name               string                                      
 7 produce_time            string                                      
 8 produce_factory_name    string                                      
 9 produce_factory_guid    string                                      
10 produce_batch_number    string                                      
11 hardware_type           int                                         
12 bike_sim                string                                      
13 bike_color              int                                         
14 bike_type               int                                         
15 bike_status             int                                         
16 bike_running_status     int                                         
17 bike_hw_status          int                                         
18 bike_chip_status        int                                         
19 bike_key                string                                      
20 control_person_id       string                                      
21 control_person_name     string                                      
22 online_time             string                                      
23 create_date             string                                      
24 update_date             string                                      
25 create_user_guid        string                                      
26 update_user_guid        string                                      
27 test_time               string                                      
28 test_user_guid          string                                      
29 test_user_name          string                                      
30 unqualified_reason      string                                      
31 service_area_id         string                                      
32 service_area_name       string                                      
33 sum_running_distance    int                                         
34 lng                     double                                      
35 lat                     double                                      
36 user_last_point_type    int                                         
37 user_last_point_time    string                                      
38 hardware_version        string                                      
39 firmware_version        string                                      
40 city_code               string                                      
41 pt                      string       
View Code

 

posted @ 2017-08-23 20:35  willie-WangLiang  阅读(3252)  评论(0编辑  收藏  举报