SQL 14
SQL 14
select REVERSE('PUNE')
--Replicate
--This function is used to reapeat a string , specified number of times.
--10.REPLACE()
--This function is used to replace all the occrances of subtring within string with
new string.
--syantx: replace('string','oldvalue','newvalue' )
select replace('scodeen','e','D')
select replace('PUNE','PU','MU')
--.Convert
--Convert() function converts a value (of any type) into a specified data type.
--Style
--Converting datetime to character:
--Without With Input/Output Standard
--century century
--0 100 mon dd yyyy hh:mi AM/PM Default
--1 101 mm/dd/yyyy US
--2 102 yyyy.mm.dd ANSI
--3 103 dd/mm/yyyy British/French
--4 104 dd.mm.yyyy German
--5 105 dd-mm-yyyy Italian
--6 106 dd mon yyyy -
--7 107 Mon dd, yyyy -
--8 108 hh:mm:ss -
--9 109 mon dd yyyy hh:mi:ss:mmmAM (or PM) Default + millisec
--10 110 mm-dd-yyyy USA
--11 111 yyyy/mm/dd Japan
--12 112 yyyymmdd ISO
--13 113 dd mon yyyy hh:mi:ss:mmm Europe (24 hour
clock)>
--14 114 hh:mi:ss:mmm 24 hour
clock
--20 120 yyyy-mm-dd hh:mi:ss ODBC canonical (24
hour clock)
--21 121 yyyy-mm-dd hh:mi:ss.mmm ODBC canonical (24 hour
clock)
-- 126 yyyy-mm-ddThh:mi:ss.mmm ISO8601
-- 127 yyyy-mm-ddThh:mi:ss.mmmZ ISO8601
(with time zone Z)
-- 130 dd mon yyyy hh:mi:ss:mmmAM Hijiri
-- 131 dd/mm/yy hh:mi:ss:mmmAM Hijiri
LTRIM,RTRIM,TRIM
--LTRIM() : this function removes leading(left) spaces from a string
--CHARINDEX
--CHARINDEX() function searches for a substring in a string and returns position.
--if string is not found then it returns 0.
--synatx: charindex('substring','string',[(start)])
select CHARINDEX('@','[email protected]', 9)
select substring('[email protected]',1,9)
select len('[email protected]')
select SUBSTRING('[email protected]',CHARINDEX('@','[email protected]')
+1,LEN('[email protected]'))
--
===================================================================================
=
--Roles and responsibilities of database Test Engineer (Data Base Testing)
--1.Analyse the SRS documnet which is prepared by BA.
--7.Verify total number of columns or count the number of columns in table as per
SRS
select COUNT(*) from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'Table_Name'