--reverse()
--This function reverse a string and returns result.
select REVERSE('PUNE')
--Replicate
--This function is used to reapeat a string , specified number of times.
--synatx: replicate(string , integer)
select REPLICATE('scodeen ', 5)
--[Link]()
--This function is used to replace all the occrances of subtring within string with
new string.
--NOTE: Search is not a case-sensitive.
--syantx: replace('string','oldvalue','newvalue' )
select replace('scodeen','e','D')
select replace('PUNE','PU','MU')
select REPLACE ('aaaaaaaaaggggggbbbbbbbbbbffffffff','bf','56')
select replace('MUMBAI','MA','BA') --O/P - MUMBAI
select replace('MUMBAI','A','BA') --O/P - MUMBBAI
--.Convert
--Convert() function converts a value (of any type) into a specified data type.
--synatx: convert (data type [(length)],expression/col_name[(style)])
select GETDATE() --2022-09-09 [Link].280
--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 [Link] ANSI
--3 103 dd/mm/yyyy British/French
--4 104 [Link] 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:[Link] ODBC canonical (24 hour
clock)
-- 126 yyyy-mm-ddThh:mi:[Link] ISO8601
-- 127 yyyy-mm-ddThh:mi:[Link] 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
select datalength(' Scodeen ')
select datalength('Scodeen ')
select (ltrim(' Scodeen ')) as ltrims
--O/P
select datalength('Scodeen ') --'Scodeen '
--RTRIM() : This function removes trailing(right) spaces from string.
select datalength(' Scodeen')
select rtrim(' Scodeen ') as rtrims
--O/P
select datalength(' Scodeen') --'Scodeen '
--TRIM() : LTRIM() + RTRIM() :
--This function is used to remove leading(Left) as well trailing(right) spaces from
string.
select datalength(' Scodeen ')
select trim(' Scodeen ') as trims
select DATALENGTH(trim(' Scodeen ')) as trims
--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('@','praveen@[Link]', 9)
select substring('praveen@[Link]',1,9)
select len('praveen@[Link]')
select SUBSTRING('praveen@[Link]',CHARINDEX('@','praveen@[Link]')
+1,LEN('praveen@[Link]'))
--[Link] to find domain or server from email column? ****VVIMP*****
create table student (S_ID int , S_ANME varchar(20),email varchar(50))
insert into student values (1,'praveen','praveen@[Link]'),
(2,'Amit','Amit@[Link]'),
(3,'Nishan','Nishan@[Link]'),(4,'Sumit','Sumit@[Link]'),
(5,'Rohit','Rohit@[Link]')
select *,CHARINDEX('@',email)+1 as starts,LEN(email) as ends from student
select * , substring(email,CHARINDEX('@',email)+1,LEN(email)) as Domain from
student
--
===================================================================================
=
--Roles and responsibilities of database Test Engineer (Data Base Testing)
--[Link] the SRS documnet which is prepared by BA.
--[Link] the test case sscenarios.
--[Link] case design
--[Link] impact of Frontend operation to the backend operation.
--5. Verify the table names as per SRS document.
--Ex: User_Detail table name is changed to User_Details in DB against SRS.
--[Link] structure of Table as per SRS.
--SP_HELP TABLE_NAME
--Ex: In table if data type size varies in BD against SRS document,Then will raise
defect and assigned to developer.
--[Link] 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'
--[Link] column names and its ordinal positions in a table.
select COLUMN_NAME,ORDINAL_POSITION from INFORMATION_SCHEMA.COLUMNS where
TABLE_NAME = 'Sales'
--[Link] constraints of table as per SRS.
--[Link] NULL values are present or not in Table.
--[Link] the number of records or count of records from table.
--[Link] the duplicate records from table.