Django ORM - QuerySet Filtering and Lookups / Ordering and Slicing QuerySets
In this video, we'll dive into many topics, including how to filter QuerySets of records in Django, using the filter() and exclude() functions, and how to pass lookups such as "gt" (greater than), "lt" (less than), "range", "in", and "startswith". We will see how these lookups translate to the underlying SQL, for example: "in" = IN operator in SQL "range" = BETWEEN operator etc We will also look at how to order QuerySets in Django, using the order_by() function, and using the model Meta class to define a default ordering. We'll also see how to apply the Lower database function in order to retrieve a case-insensitive ordering over character fields. We'll see how to index/slice into QuerySets, how to use the get() function to retrieve a model, the exists() function to check for the existence of records in a QuerySet, and the earliest() and latest() functions to retrieve the earliest and latest objects using a date/datetime field. Starter Code: https://github.com/bugbytes-io/django... ๐ ๐๐ต๐ฎ๐ฝ๐๐ฒ๐ฟ๐: 00:00 Intro 01:09 Setup and management command 04:51 Filtering QuerySets with filter() method 07:39 Getting a single model back with the get() method 10:03 Checking if QuerySet contains records with exists() method 10:38 Multiple AND conditions with the filter() method 13:24 Filtering QuerySets with the โinโ lookup 15:17 Filtering QuerySets with the exclude() method 17:52 Filtering QuerySets with โltโ and โgtโ lookups 21:39 Filtering QuerySets with the range lookup 22:52 Ordering QuerySets with the order_by() method 26:15 Case-insensitive orderings with the Lower database function 28:47 Ordering by date & datetime fields 29:25 Indexing and Slicing into QuerySets - LIMIT and OFFSET SQL statements 31:26 Adding โorderingโ field to model Meta class for default ordering 33:23 ORM earliest() and latest() functions 35:01 Meta class get_latest_by field 35:55 Filtering by foreign key values in Django โ๏ธ ๐๐๐ ๐บ๐ฒ ๐ฎ ๐ฐ๐ผ๐ณ๐ณ๐ฒ๐ฒ: To support the channel and encourage new videos, please consider buying me a coffee here: https://ko-fi.com/bugbytes โถ๏ธ Full Playlist: ย ย ย โขย Djangoย ORMย Deepย Diveย ย ๐ฆ๐ผ๐ฐ๐ถ๐ฎ๐น ๐ ๐ฒ๐ฑ๐ถ๐ฎ: ๐ Blog: https://bugbytes.io/posts/ ๐พ Github: https://github.com/bugbytes-io/django... ๐ ๐๐๐ฟ๐๐ต๐ฒ๐ฟ ๐ฟ๐ฒ๐ฎ๐ฑ๐ถ๐ป๐ด ๐ฎ๐ป๐ฑ ๐ถ๐ป๐ณ๐ผ๐ฟ๐บ๐ฎ๐๐ถ๐ผ๐ป: Github: https://github.com/bugbytes-io/django... Django filter() function: https://docs.djangoproject.com/en/4.2... Django get() function: https://docs.djangoproject.com/en/4.2... Field Lookups: https://docs.djangoproject.com/en/4.2... Django Lower function: https://docs.djangoproject.com/en/4.2... #python #django #webdevelopment #database #sql

Django Query Optimization / select_related & prefetch_related / django-debug-toolbar / N+1 Problem

Django ORM - Updating and Deleting QuerySets / ForeignKey on_delete behaviour

Why Your SQL Query Is Slow (And How to Actually Fix It)

Django Model Properties & Methods | @property decorator | get_absolute_url() method

Django Aggregation & Annotation / values() and values_list() functions

Django ORM - Querying and Creating Records / Working with Foreign Keys

Custom Model Managers and QuerySets: Graduating from Django Beginner to ORM Master with Josh Thomas

The data black hole at the center of AI

How Instagram Scaled Postgres to 2 Billion Users
![Beginner to T-SQL [Full Course]](https://i.ytimg.com/vi/cACat4KNncg/hqdefault.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLA4o6xA3UzwmxwP9P-enFU9sgxi6Q)
Beginner to T-SQL [Full Course]

But what is quantum computing? (Grover's Algorithm)

PostgreSQL Crash Course - Beginner Tutorial

Django - select_for_update() function / Locking Database Rows

Django - F Expressions for database-level operations

Django - Multiple Databases | inspectdb command | Database Routers

Learn Basic SQL in 15 Minutes | Business Intelligence For Beginners | SQL Tutorial For Beginners 1/3

Web Scraping Using Python For Beginners and File Handling in Python | Python Web Scraping

How to make 3D Games in Godot

Django - COALESCE Function and Handling NULL Values in the Database

