0% found this document useful (0 votes)
3 views7 pages

SQL Vs Python

The document provides a comparison between SQL and Python data structures, highlighting the characteristics of lists, tuples, sets, and dictionaries. Lists are mutable and ordered, tuples are immutable, sets are unordered and deduplicate items, while dictionaries consist of key-value pairs. It also notes that dictionaries preserve insertion order starting from Python 3.7.

Uploaded by

KALAISELVI
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

SQL Vs Python

The document provides a comparison between SQL and Python data structures, highlighting the characteristics of lists, tuples, sets, and dictionaries. Lists are mutable and ordered, tuples are immutable, sets are unordered and deduplicate items, while dictionaries consist of key-value pairs. It also notes that dictionaries preserve insertion order starting from Python 3.7.

Uploaded by

KALAISELVI
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

From SQL to

Python: The Data


Structures Cheat
Sheet
Python Data Structures

*Dictionaries preserve insertion order in Python


3.7+
Lists [] = SELECT Results

A list is an ordered, mutable sequence that allows


duplicates. It’s your default choice for storing and
processing data like rows, query results, or column
values.

Common Operations

Lists are ordered and mutable (you can


change them)
Tuples () = Fixed Rows

A tuple is like a list, but immutable — you cannot


change its contents after creation.

Common Operations

Tuples are ordered but immutable


Sets {} = SELECT DISTINCT

Sets are unordered and automatically deduplicate


items. You can’t access them by index

Common Operations

Sets are unordered and do not allow duplicates.


Dictionaries {key: value} = Table Row

A dictionary is a collection of key-value pairs. Each


key maps to a value.

Common Operations

Dictionaries are unordered (prior to Python 3.7)


and mutable
SQL vs Python Structure Mapping

You might also like