InBuilt Functions SQL
InBuilt Functions SQL
* It's not required to memorize all of these functions, just glance through them so you know
* Some of the functions may have additional functionalities which may not be covered in my
SQL. It does not cover all of them
gh them so you know what are the different things you can easily achieve using these inbuilt functions
y not be covered in my example. Please refer the reference links provided for additional details
these inbuilt functions
ditional details
SI.NO RDBMS FUNCTION TYPE
SELECT INSTR('techtfq', 't', 1, 3) from dual; ==> 0 (Searches for 3rd occurrence of "t". Starts
search from first character)
LENGTH('techTFQ') ==> 7
UPPER('techTFQ') ==> "TECHTFQ"
LOWER('techTFQ') ==> "techtfq"
select TRIM('F' from ' techTFQF FF') ==> "" techTFQF ""
select TRIM(' techTFQ ') ==> ""techTFQ""
select LTRIM(' techTFQ ') ==> ""techTFQ ""
select RTRIM(' techTFQ ') ==> "" techTFQ"
select department, STRING_AGG(role, ', ') WITHIN GROUP (order by role) as role
from jobs
group by department;
==>> OUTPUT:
"Data Science Data Analyst, Data Scientist, Data Engineer"
"Software Engineering Java Developer, Python Developer"
select value
from STRING_SPLIT('James,David,Robin,Mark', ',');
==>> OUTOUT:
"James
David
Robin
Mark"
select TRIM('F' from ' techTFQF FF') ==> "" techTFQF ""
select TRIM(' techTFQ ') ==> ""techTFQ""
select LTRIM(' techTFQ ') ==> ""techTFQ ""
select RTRIM(' techTFQ ') ==> "" techTFQ"
SELECT SUBSTRING_INDEX('sony sounds', 'n', 1) ==> 'so' (returns every character up to the 1st
occurrence of the delimiter "s")
SELECT SUBSTRING_INDEX('sony sounds', 'n', 2) ==> 'sony sou' (returns every character up to the
2nd occurrence of the delimiter "s")
SELECT SUBSTRING_INDEX('sony sounds', 'n', -1) ==> 'ds' (returns every character from the right
of the string up to the 1st occurrence of the character "s")
calculate ages
returns the current date
returns the current time with time zone
returns the current date and time with time zone, which is the time when
the transaction starts
retrieves a field such as a year, month, and day from a date/time value
Return the current date and time with time zone in the session time zone
Extract a value of a date time field e.g., YEAR, MONTH, DAY, … from a date
time value.
Gets the last day of the month of a specified date.
Return the number of months between two dates.
Get the first weekday that is later than a specified date.
Return the current system date and time of the operating system where the
Oracle Database resides.
Convert a DATE or an INTERVAL value to a character string in a specified
format.
Convert a date which is in the character string to a DATE value.
Return a date truncated to a specific unit of measure.
Returns the position of a substring in a string
join multiple strings into one string
Used to extract a given number of characters from the left side of the given
string
delete a part of a string and then insert a substring into the string, beginning
at a specified position.
Returns the current system date and time without the time zone part.
Returns the current system date and time of the operating system on which
the SQL Server is running.
Returns a date part of a date as a character string
Returns a date part of a date as an integer number
Returns the day of a specified date as an integer
Returns the month of a specified date as an integer
Returns the year of the date as an integer.
calculate the number of years, months, weeks, days,etc., between two
dates.
Adds a value to a date part of a date and return the new date value.
https://www.postgresqltutorial.com/postgresql-string-functions/postgresql-left/
https://www.postgresqltutorial.com/postgresql-date-functions/postgresql-age/
https://www.oracletutorial.com/oracle-string-functions/
https://www.oracletutorial.com/oracle-date-functions/
https://www.sqlservertutorial.net/sql-server-string-functions/
https://www.sqlservertutorial.net/sql-server-date-functions/
https://www.mysqltutorial.org/mysql-string-functions/
https://www.mysqltutorial.org/mysql-date-functions/
TOPIC PLATFORM
Python course
https://datalemur.com/
https://learnsql.com/?ref=thoufiqmohammed Affiliate link
https://www.stratascratch.com/?via=techTFQ Affiliate link
https://leetcode.com/
https://www.hackerrank.com/
https://codebasics.io/courses/python-for-beginner-and-intermediate-learners?refId=70170e4c-7511-4c83-b769-c5
Affiliate link
https://codebasics.io/courses/power-bi-data-analysis-with-end-to-end-project?refId=4b1e1886-3252-4bf1-86f4-7d
Affiliate link