Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Otwell J2112O

View GitHub Profile
View dynamic_rpad.sql
SELECT
RPAD(first_name,
CASE WHEN LENGTH(first_name) < :max_fname_len THEN :max_fname_len - LENGTH(first_name) + LENGTH(first_name) ELSE :max_fname_len END, '*') AS padded_fname
FROM friends;
View bind_var.sql
VAR max_fname_len NUMBER;
BEGIN
SELECT MAX(LENGTH(FIRST_NAME)) INTO :max_fname_len
FROM FRIENDS;
END;
/
print max_fname_len;
View max_f_name.sql
SELECT MAX(LENGTH(FIRST_NAME)) AS longest_length_name
FROM FRIENDS;
View first_name_len.sql
SELECT FIRST_NAME, LENGTH(FIRST_NAME)
FROM FRIENDS;
View up_to_midnite.sql
SELECT *
FROM practice_names
WHERE inclusion_date BETWEEN '2021–05–31' AND '2021–06–02 23:59:59' ;
View time_portion.sql
SELECT *
FROM practice_names
WHERE inclusion_date BETWEEN '2021–05–31' AND '2021–06–02 19:07:59';
View cast.sql
SELECT *
FROM practice_names
WHERE CAST(inclusion_date AS DATE) BETWEEN '2021–05–31' AND '2021–06–02';
View between.sql
SELECT *
FROM practice_names
WHERE inclusion_date BETWEEN '2021–05–31' AND '2021–06–02';