SShortSingh.
Back to feed

SQL Advanced Functions Explained: Numeric, String, Date, and Conditional Operations

0
·2 views

A technical guide published on DEV Community outlines advanced SQL functions that go beyond basic data selection and filtering. The article categorizes these functions into numeric, string, conditional, and date types, covering operations such as FLOOR, CEILING, ROUND, ABS, and MOD. It explains practical use cases, such as using FLOOR to calculate full hours from minutes and MOD to distribute data into groups or identify even-numbered rows. The guide also highlights key differences across database engines, noting that SQL Server uses LEN() instead of LENGTH() and handles ROUND differently from PostgreSQL. Special attention is given to NULL handling in string concatenation, warning that operator-based joins can silently return NULL when any component value is missing.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

React useCookie Hook Turns Browser Cookies into Reactive Component State

A new hook called useCookie, available from the @reactuses/core library, allows React developers to manage browser cookies as reactive state rather than relying on the native document.cookie API. The native API requires manual string parsing, does not trigger re-renders, and can cause hydration mismatches during server-side rendering. With useCookie, components reading the same cookie key stay synchronized within a tab, and updates automatically propagate without extra boilerplate. The hook is built on the js-cookie library, meaning cookie attributes such as expiry, path, and SameSite are handled reliably through a structured options argument. Setting a value to undefined deletes the cookie, and passing a default value ensures the cookie is written on first render, making it immediately available to the server on subsequent requests.

0
ProgrammingDEV Community ·

Extension Blocks in C# 14 Are More Than New Syntax

Extension methods have been part of C# for years. Extension blocks finally make them feel like a small, organized API. Extension methods are one of those C# features that quietly end up everywhere. LINQ depends on them, library authors use them to improve APIs they do not control, and most production codebases eventually collect a few SomethingExtensions classes. The familiar syntax works, but it starts to feel awkward when several related operations target the same type: public static class DateOnlyExtensions { public static bool IsWeekend(this DateOnly date) => date.DayOfWeek is DayOfWeek.Sa

0
ProgrammingDEV Community ·

Developer Builds Severity-Classifying Terraform Drift Alert Using AWS SNS, SQS, and Lambda

A developer overhauled a basic Terraform drift detection system after finding it only confirmed drift existed without identifying which resources changed or how critical the changes were. The updated pipeline uses CodeBuild to run terraform plan, extracts changed resource data via terraform show -json, and publishes a structured event through SNS. That event is simultaneously routed to an SQS queue for audit logging and a Lambda function that classifies each change as HIGH, MEDIUM, or LOW severity, with results stored in CloudWatch. To keep payloads lean, only the resource address, type, and action fields are extracted using jq, rather than publishing the full before-and-after plan. During testing, a region mismatch between the AWS CLI default and the queue's actual region caused a false NonExistentQueue error, resolved by explicitly specifying the correct region in the CLI command.

0
ProgrammingDEV Community ·

Engineers Find Security Flaws in App a Vietnamese CEO Said AI Built Cheaply

A Vietnamese CEO recently claimed that a $20/month Claude subscription had replaced his company's software developers, sparking widespread debate across social media. Curious engineers tracked down the application behind the viral post and began inspecting it using browser DevTools. They quickly uncovered serious security issues, including exposed credentials in frontend code, unprotected admin pages hidden only by CSS, and missing server-side authorization checks. The findings spread rapidly through Vietnamese tech communities, shifting the conversation from AI's code-writing ability to what separates functional software from production-ready systems. Commentators noted the flaws did not prove AI writes bad code, but rather highlighted that software engineering involves far more than generating working code.