Select statement
A select statement is a language construct that retrieves selected data or chooses among alternative operations or cases according to the language's rules.
Learn Concurrent Programming with Go
A select statement is a Go control-flow construct that waits for and chooses among channel communication operations.
- How it is used
- Coordinates concurrent sends and receives across channels, including waiting, fallback work, timeouts, and shutdown signals.
- How deep it goes
- Works through blocking receives, default cases, sends, nil-case disabling, and practical channel coordination patterns.
- Examples
- Uses ticking channels, delayed messages, prime filtering, sales and expenses, temperature updates, games, and triangular numbers.
- What you can do after
- Apply it via Go select to multiplex channel work, avoid unwanted blocking, disable closed inputs, and stop goroutines.
Read how Learn Concurrent Programming with Go explains select statement →
Learn Go with Pocket-Sized Projects
A select statement is a Go control-flow construct that chooses among channel send, channel receive, and optional default cases that are ready to proceed.
- How it is used
- Coordinates channel-based work and termination, and keeps a WebAssembly program available to JavaScript.
- How deep it goes
- Explains case selection, repeated listening, quit checks and blocking, without detailing runtime internals.
- Examples
- Uses a concurrent maze solver’s path and quit channels and a JavaScript-callable function kept alive in WebAssembly.
- What you can do after
- Apply it to coordinate channel operations, check for termination and keep a program running.
Read how Learn Go with Pocket-Sized Projects explains select statement →
100 Go Mistakes and How to Avoid Them
A select statement is a Go control-flow construct that waits for and executes a communication operation from among channel cases.
- How it is used
- Coordinates channel operations while handling cancellation, disconnection, and channel closure.
- How deep it goes
- Explains case selection and closed-channel behavior through incorrect implementations and contextual fixes.
- Examples
- Uses a message-and-disconnection loop, a two-channel merge, and context-aware sends and receives.
- What you can do after
- Diagnose concurrency bugs caused by assumed case priority or repeated receives from closed channels.
Read how 100 Go Mistakes and How to Avoid Them explains select statement →
Go in Action, Second Edition
A select statement is a Go control construct that waits for and proceeds with a communication operation that is ready among multiple channel operations.
- How it is used
- Coordinates feed processing and error reporting in a responsive concurrent event loop.
- How deep it goes
- Explains readiness and default cases with an event-loop listing, but does not detail selection when multiple operations are ready.
- Examples
- Uses a feed-processing loop that receives feed URLs and errors on separate channels.
- What you can do after
- Apply select to coordinate channel-based work and error handling in an event loop.
Read how Go in Action, Second Edition explains select statement →
Statistics Slam Dunk
A SELECT statement is an SQL query construct that specifies the fields or expressions to retrieve from a data source.
- How it is used
- Uses focused queries to retrieve NBA records and investigate data-quality issues before further analysis.
- How deep it goes
- Explains SELECT, FROM, WHERE, and AND through executable queries, while deferring reusable analysis objects to dplyr.
- Examples
- Demonstrates win-share extremes, blank teams, team-season records, and comparisons between gini3 and ranked gini4 data.
- What you can do after
- Apply it via sqldf() to retrieve selected fields, filter records, and inspect short result sets.
Logs and Telemetry
A SELECT statement is a query construct that projects fields or computed values from a stream or tagged event source.
- How it is used
- Filters and projects records inside Fluent Bit stream processing before downstream output.
- How deep it goes
- Explains expression structure, tagged sources, configuration separation, functions, filtering, and observed output without covering query internals.
- Examples
- Uses random input records, tagged rand_value fields, aggregate functions, timestamps, WHERE filtering, and Fluent Bit configuration listings.
- What you can do after
- Build it from scratch by defining stream tasks, selecting tagged fields, applying functions or filters, and wiring Fluent Bit configuration.
Python Concurrency with asyncio
select is a selector operation that waits for monitored resources to become ready or for a timeout and returns the resulting events.
- How it is used
- Drives an efficient socket event loop for concurrent applications and underlies asyncio’s handling of non-blocking sockets.
- How deep it goes
- Explains registration, readiness results, timeouts, and event-loop usage without descending into platform-specific notification internals.
- Examples
- Uses a non-blocking echo server with registered sockets, timed polling, and event dispatch.
- What you can do after
- Build it from scratch as a selector-based non-blocking socket loop serving multiple clients.
Read how Python Concurrency with asyncio explains select statement →
DuckDB in Action
A SELECT statement is an SQL statement that retrieves rows and expressions from one or more data sources.
- How it is used
- Uses SELECT to inspect, filter, transform, deduplicate, and pipeline data from tables or CSV relations.
- How deep it goes
- Explains practical composition with WHERE, DISTINCT, CASE, and external CSV sources while deferring detailed SELECT anatomy.
- Examples
- Demonstrates daily readings, distinct systems, remote CSV ingestion, generated URLs, and SELECT-fed INSERT statements.
- What you can do after
- Apply it via DuckDB to inspect readings, clean source values, deduplicate rows, and route query results into tables.
Go in Practice, Second Edition
- How it is used
- Coordinates channel communication while allowing a goroutine to stop waiting when a completion or timeout signal arrives.
- How deep it goes
- Explains readiness, waiting, default behavior, channel direction, and a complete timeout-driven echo implementation.
- Examples
- Uses a standard-input echo program that receives input through a channel and times out after thirty seconds.
- What you can do after
- Build interruptible channel workflows that handle data events and timeout events in one control structure.
Read how Go in Practice, Second Edition explains select statement →
Also covered in
What to know first
- goroutineA goroutine is a lightweight function execution unit managed by the Go runtime that runs concurrently with other program activity.
- channelA channel is a medium or logical pathway for conveying information, messages, or other content between sources and recipients.
- handlerA handler is a software routine or component invoked to process an event, request, message, or other input.
- GoGo is a statically typed, compiled, general-purpose programming language with garbage collection and built-in support for concurrency.
Related concepts
- channeluses · A channel is a medium or logical pathway for conveying information, messages, or other content between sources and recipients.
- default casehas part · A default case is the switch or select execution path chosen when no other eligible case matches or can be selected.
- break statementused by · A break statement terminates the nearest supported enclosing loop, switch, or similar control construct and transfers control to the following statement.
- channeluses · A channel is a typed Go communication and synchronization mechanism through which goroutines send and receive values.
- circular waitaddresses · A circular wait is a dependency cycle in which each concurrent execution waits for a condition or resource held by another execution in the cycle.
- closed channeluses · A closed channel is a Go channel that accepts no further sends while allowing receives to complete, including delivery of buffered values.
Questions about select statement
What is select statement?
A select statement is a language construct that retrieves selected data or chooses among alternative operations or cases according to the language's rules.
Which Manning books explain select statement?
Learn Concurrent Programming with Go, Learn Go with Pocket-Sized Projects, 100 Go Mistakes and How to Avoid Them, Go in Action, Second Edition, Statistics Slam Dunk, Logs and Telemetry, Python Concurrency with asyncio, DuckDB in Action and 1 more.
What should I know before learning select statement?
Manning books that teach select statement usually introduce goroutine, channel, handler and Go first.
What are the parts of select statement?
Select statement includes default case.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.








