Column Types and Constraints

SQL में Exploratory Data Analysis

Christina Maimone

Data Scientist

Column constraints

  • Foreign key: संदर्भित कॉलम में मौजूद मान, या NULL
  • Primary key: यूनिक, NULL नहीं

  • Unique: NULL को छोड़कर सभी मान अलग होने चाहिए

  • Not null: NULL अनुमत नहीं: कोई मान होना चाहिए

  • Check constraints: मानों पर शर्तें

    • column1 > 0
    • columnA > columnB
SQL में Exploratory Data Analysis

Data types

Common

  • Numeric
  • Character
  • Date/Time
  • Boolean

Special

  • Arrays
  • Monetary
  • Binary
  • Geometric
  • Network Address
  • XML
  • JSON
  • और भी!
SQL में Exploratory Data Analysis

Numeric types: PostgreSQL documentation

न्यूमेरिक डेटा टाइप के नाम और विवरण की तालिका

SQL में Exploratory Data Analysis

एंटिटी-रिलेशनशिप डायग्राम में टाइप्स

Fortune 500 डेटाबेस टेबल

SQL में Exploratory Data Analysis

CAST() से कास्ट करना

Format

-- With the CAST function
SELECT CAST (value AS new_type);

Examples

-- Cast 3.7 as an integer
SELECT CAST (3.7 AS integer);
4
-- Cast a column called total as an integer
SELECT CAST (total AS integer)
  FROM prices;
SQL में Exploratory Data Analysis

:: से कास्ट करना

Format

-- With :: notation
SELECT value::new_type;

Examples

-- Cast 3.7 as an integer
SELECT 3.7::integer;
-- Cast a column called total as an integer
SELECT total::integer
  FROM prices;
SQL में Exploratory Data Analysis

अभ्यास करते हैं!

SQL में Exploratory Data Analysis

Preparing Video For Download...