0

دانلود کتاب SQL پیشرفته

  • عنوان کتاب: Advanced SQL
  • نویسنده: Rui Machado
  • حوزه: آموزش SQL
  • سال انتشار: 2026
  • تعداد صفحه: 618
  • زبان اصلی: انگلیسی
  • نوع فایل: pdf
  • حجم فایل: 17.7 مگابایت

لحظه‌ای وجود دارد، و شاید شما قبلاً آن را تجربه کرده‌اید، که از یک مدل زبان بزرگ می‌خواهید یک کوئری SQL بنویسد، و او بدون هیچ تردیدی و با کیفیتی بهتر از آنچه انتظار داشتید، این کار را انجام می‌دهد. یک تابع پنجره‌ای، یک عبارت جدولی مشترک بازگشتی (CTE)، یک اتصال جانبی که بیست دقیقه تفکر دقیق برای شما طول می‌کشید: در عرض چند ثانیه انجام می‌شود. برای بسیاری از متخصصان، این لحظه ترکیبی عجیب از آسودگی و ناراحتی ایجاد می‌کند. اگر ماشین می‌تواند این کار را انجام دهد، ممکن است بپرسید، من دقیقاً برای چه اینجا هستم؟ ما بخش زیادی از این کتاب را قبل از اینکه این سوال ضروری شود، نوشتیم. اما همزمان با نوشتن، دنیا زیر پای ما تغییر کرد و ما به شما یک گزارش صادقانه از معنای این تغییر بدهکاریم و توضیح می‌دهیم که چرا این تغییر بیش از هر زمان دیگری اهمیت دارد. ابزارهایی مانند Claude و ChatGPT کار قابل توجهی انجام داده‌اند: آنها SQL پیشرفته را برای هر کسی که مایل به توصیف آنچه نیاز دارد به زبان ساده است، در دسترس قرار داده‌اند. مانع نحوی، که مدت‌ها دیواری بود که کسانی را که می‌توانستند سیستم‌های داده بسازند از کسانی که صرفاً از آنها استفاده می‌کردند، جدا می‌کرد، در حال فرو ریختن است. توابع پنجره‌ای دیگر نیازی به مراسم جستجوهای سرریز پشته ندارند. تجمیع‌های پیچیده دیگر به متخصص نیاز ندارند. یک متخصص حوزه که کسب و کار را درک می‌کند، اکنون بیش از هر زمان دیگری می‌تواند مستقیماً به داده‌ها دسترسی پیدا کند. این واقعاً خوب است و ارزش تجلیل دارد. اما توانایی بدون درک، خطرناک است. یک مدل زبان بزرگ (LLM) می‌تواند یک پرس‌وجوی ساختاریافته زیبا ایجاد کند که چیز اشتباهی را به صورت بی‌صدا، قابل قبول و در مقیاس بزرگ محاسبه کند. می‌تواند یک استراتژی پارتیشن‌بندی ایجاد کند که روی مجموعه داده‌های توسعه شما کار کند و عملکرد را در تولید از بین ببرد. می‌تواند خطوط لوله ویژگی‌های یادگیری ماشین را در SQL بنویسد که صحیح به نظر برسند و نشت داده‌های ظریفی را رمزگذاری کنند که هر مدل آموزش داده شده روی آنها را مسموم می‌کند. پرس‌وجو اجرا می‌شود، اعداد ظاهر می‌شوند و تصمیمات گرفته می‌شوند. وقتی تصمیم گرفتیم این کتاب را بنویسیم، مدام به یک کلمه واحد برمی‌گشتیم: اعتماد. نه اعتماد به معنای فنی محدود، اگرچه محدودیت‌ها، آزمایش‌ها و قراردادهای داده بسیار مهم هستند، بلکه اعتماد به معنای انسانی. اعتمادی که یک مدیر ارشد درآمد هنگام نقل عددی در جلسه هیئت مدیره احساس می‌کند. اطمینانی که یک دانشمند داده دارد مبنی بر اینکه ویژگی‌های وارد شده به مدلش، واقعیت را منعکس می‌کنند، نه اینکه مصنوعی از نحوه نوشتن استخراج، تبدیل و بارگذاری (ETL) باشند. لحظه‌ای که داده‌ها دیگر منبع اضطراب نیستند و به پایه‌ای واقعی برای عمل تبدیل می‌شوند. این نوع اعتماد، ویژگی کد نیست؛ بلکه ویژگی متخصصی است که آن را نوشته است. هر تصمیمی در کار SQL پیشرفته، قضاوتی را به همراه دارد: نحوه برخورد با مقادیر NULL در مرز یک اتصال، نحوه تعریف دانه قبل از تجمیع، نحوه در نظر گرفتن رویدادهای دیررس در یک محاسبه سری زمانی و اینکه آیا یک ویژگی یادگیری ماشین باید قبل یا بعد از یک رویداد تجاری خاص محاسبه شود. این تصمیمات نیاز به زمینه‌ای دارند که خارج از هر اعلانی، تاریخچه سازمانی، ویژگی‌های خاص شناخته شده یک سیستم منبع، بحث سه ماهه گذشته در مورد نحوه برخورد با بازپرداخت‌ها یا تعریف ضمنی “تبدیل” که بین تیم‌ها متفاوت است، وجود دارد. LLMها در اجرا فوق‌العاده هستند. اما آنها، ذاتاً، قادر به مدیریت کارآمد زمینه نیستند. شما کسی هستید که آن را در اختیار دارید. این باعث می‌شود که شما در عصر هوش مصنوعی مولد، مهم‌تر شوید، نه کمتر. به طور متناقضی، هر چه تولید کد آسان‌تر شود، درک عملکرد آن کد حیاتی‌تر می‌شود. زمانی که نوشتن SQL کند و عمدی بود، خطاها در حین تلاش کشف می‌شدند. امروزه، وقتی پنجاه خط می‌تواند در عرض چند ثانیه تولید شود، تنگنا از تولید به تأیید تغییر کرده است. و شما نمی‌توانید چیزی را که نمی‌فهمید تأیید کنید. این کتاب SQL پیشرفته را نه به عنوان یک مصنوع تاریخی، بلکه به عنوان زبان زنده سیستم‌های داده مدرن، بستری که پلتفرم‌های تحلیلی، خطوط لوله بلادرنگ و برنامه‌های یادگیری ماشین بر روی آن ساخته می‌شوند، پوشش می‌دهد. وقتی بفهمید که چگونه توابع پنجره‌ای وضعیت را در پارتیشن‌های مرتب ردیابی می‌کنند، خواهید فهمید که چه زمانی کد تولید شده به طور نادرست روابط را مدیریت می‌کند. وقتی مکانیک پردازش افزایشی را بفهمید، لحظه‌ای را که یک رویکرد پیشنهادی هوش مصنوعی، رکوردها را تحت داده‌های دیرهنگام کپی می‌کند، درک خواهید کرد. وقتی بفهمید که چگونه SQL با گردش‌های کاری ML، فروشگاه‌های ویژگی، خطوط لوله آموزشی و امتیازدهی مدل ادغام می‌شود، تشخیص خواهید داد که چه زمانی یک پرس‌وجوی با نیت خیر، نشتی بین آموزش و ارائه ایجاد کرده است که فقط زمانی که مدل در حال تولید است، آشکار می‌شود. درک سیستم، جایگزینی برای استفاده از کمک هوش مصنوعی نیست. این چیزی است که استفاده از کمک هوش مصنوعی را ایمن می‌کند. فصل‌های پیش رو عمداً از مبانی مکانیک پرس‌وجوی پیشرفته به معماری راه‌حل‌های داده مدرن و به قلمرویی که SQL با یادگیری ماشینی تلاقی می‌کند، حرکت می‌کنند. هر بخش بر اساس بخش قبلی بنا شده است و ما عمداً سعی کرده‌ایم نه تنها چگونگی، بلکه دلیل آن را نیز به شما نشان دهیم: استدلال پشت هر الگو و بده‌بستان‌های آن. ما شما را تشویق می‌کنیم که با یک متخصص LLM در کنار خود مطالعه کنید. مثال‌هایی ایجاد کنید، تغییرات را درخواست کنید، مدل را به سمت بازسازی سوق دهید و سپس

There is a moment, and perhaps you have already lived it, when you ask a large language model to write a SQL query, and it does, without hesitation and with better quality than you were expecting. A window function, a recursive common table expression (CTE), a lateral join that would have taken you twenty minutes of careful thinking: done in seconds. For many practitioners, this moment produces a peculiar mix of relief and unease. If the machine can do this, you may ask, what exactly am I here for? We wrote much of this book before that question became urgent. But the world shifted under our feet as we wrote, and we owe you an honest account of what that shift means, explaining why it matters more than ever. Tools like Claude and ChatGPT have done something remarkable: they have made advanced SQL accessible to anyone willing to describe what they need in plain language. The syntax barrier, for so long the wall separating those who could build data systems from those who merely used them, is coming down. Window functions no longer require a ritual of Stack Overflow searches. Complex aggregations no longer demand a specialist. A domain expert who understands the business can now, more than ever before, reach directly into the data. This is genuinely good and is worth celebrating. But capability without understanding is dangerous. A large language model (LLM) can generate a beautifully structured query that computes the wrong thing, silently, plausibly, and at scale. It can produce a partition strategy that works on your development dataset and destroys performance in production. It can write ML feature pipelines in SQL that look correct and encode subtle data leakage that poisons every model trained on them. The query runs, the numbers appear, and decisions get made. When we set out to write this book, we kept returning to a single word: trust. Not trust in a narrow technical sense, though constraints, tests, and data contracts matter enormously, but trust in a human sense. The confidence a chief revenue officer feels when quoting a number in a board meeting. The certainty a data scientist has that the features fed into her model reflect reality rather than an artifact of how the extract, transform, and load (ETL) was written. The moment when data stops being a source of anxiety and becomes a genuine foundation for action. That kind of trust is not a property of the code; it is a property of the practitioner who wrote it. Every decision in advanced SQL work carries judgment: how you handle NULLs at the boundary of a join, how you define the grain before aggregating, how you account for late-arriving events in a time-series computation, and whether a machine learning feature should be calculated before or after a specific business event. These decisions require context that lives outside any prompt, the organizational history, the known quirks of a source system, the argument last quarter about how refunds should be treated, or the implicit definition of “conversion” that differs between teams. LLMs are extraordinary at execution. But they are, by their nature, unable to handle context efficiently. You are the one who holds it. That makes you, in the age of generative AI, more important, not less. Paradoxically, the easier it becomes to generate code, the more critical it becomes to understand what that code does. When writing SQL was slow and deliberate, errors were caught in the effort. Today, when fifty lines can be generated in seconds, the bottleneck has shifted from production to verification. And you cannot verify what you do not understand. This book covers advanced SQL not as a historical artifact but as the living language of modern data systems, the substrate on which analytical platforms, real-time pipelines, and machine learning applications are built. When you understand how window functions track state across ordered partitions, you will know when the generated code handles ties incorrectly. When you understand the mechanics of incremental processing, you will catch the moment an AI-suggested approach duplicates records under late data. When you understand how SQL integrates with ML workflows, feature stores, training pipelines, and model scoring, you will identify when a well-intentioned query has introduced a leak between training and serving that will surface only when the model is in production. Understanding the system is not an alternative to using AI assistance. It is what makes AI assistance safe to use. The chapters ahead move deliberately from the foundations of advanced query mechanics through the architecture of modern data solutions and into the territory where SQL meets machine learning. Each section builds on the previous one, and we have been intentional about showing you not just how but why: the reasoning behind every pattern and the trade-offs it makes. We encourage you to read with an LLM by your side. Generate examples, ask for variations, push the model to refactor and then interrogate its choices. Use it as a tireless collaborator, one that is fast, knowledgeable, and completely dependent on you to set direction, define standards, and catch mistakes. That is the appropriate relationship between a skilled practitioner and an AI tool. Not replacement. Not fear. Partnership, with your judgment at the center. This book does not aim to make you faster at writing SQL. Rather, its goal is to make you the kind of practitioner who can be trusted: with complex systems, with data that drives consequential decisions, with the ML applications that increasingly shape what organizations know about the world. In a moment when code can be written almost on demand, that trust is the rarest and the most valuable thing you can offer. Build systems worth trusting, guide the machines well. That has always been the work, and it still is.

این کتاب را میتوانید از لینک زیر بصورت رایگان دانلود کنید:

Download: Advanced SQL

نظرات کاربران

  •  چنانچه دیدگاه شما توهین آمیز باشد تایید نخواهد شد.
  •  چنانچه دیدگاه شما جنبه تبلیغاتی داشته باشد تایید نخواهد شد.

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *