SQL optimization for GROUP by statements

Source: Internet
Author: User

SQL statement:

Select T.type, COUNT (t.id) as Todo_count from Mc_job_form t where t.state = ' 2 ' and T.customs_code =: a GROUP by T.type

Table structure:

ID VARCHAR2 (N) ID

In_out_flag CHAR (1) Y

PROVIDER_ID number Y

apply_form_id VARCHAR2 (Y)

declare_apply_id VARCHAR2 (Y)

proposer_id VARCHAR2 (Y)

manual_id CHAR (Y)

Trade_type VARCHAR2 (3) Y

Company_code CHAR (Y)

Company_Name NVARCHAR2 (m) Y

Provider_name NVARCHAR2 (m) Y

Gross_weight number (19,5) Y

Net_weight number (19,5) Y

AMOUNT number (19,5) Y

Wrap_type VARCHAR2 (Y)

Trunk_no NVARCHAR2 (255) Y

Create_time DATE Y

Declare_time DATE Y

In_time DATE Y

Customs_code CHAR (4) Y

PORT CHAR (4) Y

Remark NVARCHAR2 (255) Y

State CHAR (1) Y

COMMENTS NVARCHAR2 (Y)

TYPE VARCHAR2 (2) Y

Proposer NVARCHAR2 (Y)

Out_time DATE Y

Proposer_phone VARCHAR2 (Y)

Contract_no VARCHAR2 (Y)

Tally_comments NVARCHAR2 (Y)

Tally_time DATE Y

Tally_approve_comments NVARCHAR2 (Y)

asso_job_form_id VARCHAR2 (Y)

Data_origin CHAR (1) Y

Guaranty_amount number (19,5) Y

Asso_flag CHAR (1) Y

Area_type CHAR (1) Y

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.