कैरेक्टर डेटा टाइप्स और आम समस्याएँ

SQL में Exploratory Data Analysis

Christina Maimone

Data Scientist

PostgreSQL कैरेक्टर टाइप्स

character(n) या char(n)

  • फिक्स्ड लंबाई n
  • तुलना में ट्रेलिंग स्पेसेज़ नज़रअंदाज़ होते हैं

character varying(n) या varchar(n)

  • अधिकतम n तक वैरिएबल लंबाई

text या varchar

  • अनलिमिटेड लंबाई
SQL में Exploratory Data Analysis

टेक्स्ट डेटा के प्रकार

Categorical

Tues, Tuesday, Mon, TH

shirts, shoes, hats, pants

satisfied, very satisfied, unsatisfied

0349-938, 1254-001, 5477-651

red, blue, green, yellow

Unstructured Text

I really like this product. I use it every day. It's my favorite color.

We've redesigned your favorite t-shirt to make it even better. You'll love...

Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal...

SQL में Exploratory Data Analysis

ग्रुपिंग और काउंटिंग

SELECT category,        -- categorical variable

       count(*)         -- count rows for each category

  FROM product          -- table

 GROUP BY category;     -- categorical variable


 category | count 
----------+-------
 Banana   |     1
 Apple    |     4
 apple    |     2
  apple   |     1
 banana   |     3
(5 rows)
SQL में Exploratory Data Analysis

क्रम: सबसे अधिक आवृत्ति वाले मान

SELECT category,        -- categorical variable

       count(*)         -- count rows for each category

  FROM product          -- table

 GROUP BY category      -- categorical variable

 ORDER BY count DESC;   -- show most frequent values first
 category | count 
----------+-------
 Apple    |     4
 banana   |     3
 apple    |     2
 Banana   |     1
  apple   |     1
(5 rows)
SQL में Exploratory Data Analysis

क्रम: श्रेणी मान

SELECT category,        -- categorical variable

       count(*)         -- count rows for each category

  FROM product          -- table

 GROUP BY category      -- categorical variable

 ORDER BY category;     -- order by categorical variable
 category | count 
----------+-------
  apple   |     1
 Apple    |     4
 Banana   |     1
 apple    |     2
 banana   |     3
(5 rows)

SQL में Exploratory Data Analysis

वर्णानुक्रम

-- Results

 category | count 
----------+-------
  apple   |     1
 Apple    |     4
 Banana   |     1
 apple    |     2
 banana   |     3
(5 rows)

-- Alphabetical Order:

' ' < 'A' < 'a'
-- From results

' ' < 'A' < 'B' < 'a' < 'b'

SQL में Exploratory Data Analysis

आम समस्याएँ

Case मायने रखता है

    'apple' != 'Apple'

 

Spaces गिने जाते हैं

    ' apple' != 'apple'

    '' != '       '

Empty strings null नहीं होते

    '' != NULL

 

Punctuation में फर्क पड़ता है

    'to-do' != 'to–do'

SQL में Exploratory Data Analysis

अब कुछ टेक्स्ट डेटा जाँचते हैं

SQL में Exploratory Data Analysis

Preparing Video For Download...