
Oracle BIT_AND_AGG Function
Combine flag integers bit by bit over a group to find options common to all rows or available in any, and decode them with BITAND.
Posts tagged AI-Assisted are created with support from artificial intelligence. I use AI tools to research, draft, and refine ideas—combining human insight with machine precision to deliver clear, informed, and creative content.

Combine flag integers bit by bit over a group to find options common to all rows or available in any, and decode them with BITAND.

Check whether all or any rows of a group are true, such as all passengers checked in, with BOOLEAN_AND_AGG, BOOLEAN_OR_AGG, and EVERY.

Get values from the first or last row of each group, such as the earliest hire's salary, with KEEP (DENSE_RANK FIRST ORDER BY ...).

Describe the shape of your data beyond mean and spread: measure lopsidedness with SKEWNESS and the weight of the tails with KURTOSIS.

Fit a least-squares line through pairs of values with REGR_SLOPE and REGR_INTERCEPT, measure the fit with REGR_R2, and predict values.

Measure whether two columns rise and fall together with COVAR_POP and COVAR_SAMP, and see how units change covariance but not correlation.

Measure how closely two columns move together with Pearson, Spearman, and Kendall correlation, and why per-group results can differ.

Measure the spread of each group as the mean squared deviation with VARIANCE, and choose between the population and sample versions.

Measure how spread out the values of each group are with STDDEV, and choose between the population and sample versions correctly.

Get percentiles that are actual values from the data with PERCENTILE_DISC, and see how they differ from interpolated PERCENTILE_CONT.

Compute medians, quartiles, and 90th percentiles of each group with PERCENTILE_CONT, which interpolates between the nearest values.

Find the most frequent value in each group, such as the usual base airport or cabin, with STATS_MODE, and know how it handles ties.

Find the middle value of each group with MEDIAN, and see why it describes skewed data such as salaries better than the average.

Select a column that has the same value in every row of a group without adding it to GROUP BY or wrapping it in MAX, and avoid ORA-00979.

Compute several counts and totals over different subsets of rows in one query with FILTER (WHERE ...), instead of CASE inside aggregates.

Find the largest value, latest date, or worst delay in each group with MAX, and learn when GREATEST is the function you need.

Find the smallest number, the earliest date, or the first name alphabetically in each group with MIN, and get other columns of that row.

Average the values of each group with AVG, understand how NULLs change the divisor, and average intervals in Oracle AI Database 26ai.