Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
100%
(1)
100% found this document useful (1 vote)
41 views
SQL Functions
sql knowledge
Uploaded by
Bình Nguyễn Vệ
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Sql functions For Later
Download
Save
Save Sql functions For Later
100%
100% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
100%
(1)
100% found this document useful (1 vote)
41 views
SQL Functions
sql knowledge
Uploaded by
Bình Nguyễn Vệ
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Sql functions For Later
Carousel Previous
Carousel Next
Save
Save Sql functions For Later
100%
100% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 16
Search
Fullscreen
Structured Query language (SQL) SQL Commands cL (dea witness pL (detnedatabase | [ome maninuate data] [rigs and date conta], TEL(éeae withthe | | Da rettove daa schemainOBWS} | |” preentinthe08) "| onthe data presenein| "™"s*Cvershegpenie| trom the DU wig the db) = CREATE INSERT ‘RANT cownarr seuect ono? uPpare REVOKE frowsace ATER oeLeTe ODL : Data Definition Language DML. Dota Manipulation Language aan (ct: oto contro! Longuage TL: Trorsocton Control Lanquoge (Dota Query canavage 1. Create database create database sample2 2._ Use the database use sample2 3. Create table create table customer ( customerid int identity(1.1) primary key, customernumber int not null unique check (customernumber>0) lastname varchar|30) not null firstname varchar(30) not ull areacode int default 71000, address varchar|50}, country varchar|50) default ‘Malaysia’ ) 4, Insert values into table insert into customer values (100,'Fang Ying''Sham’,'418999','sdadasfdfd’ default) (200,'Mei Mei’,"Tan’ default 'adssdsadsd',"Thailand’), (300,'Albert’ John’ default,'dfdsfsdf’,default) 5. Display record from table ~ display all records select * from customer display particular columns select customerid, customernumber, lastname, firstname ron customer 6. Add new column to table 7. Add values to newly added column/ Update table alter table customer add_phonenunber varchar (20) _ update customer set phonenumber~' 1234545346" where customer id=1 update customer set phonenumber='45554654' where customerid=2 8. Delete a column alter table customer drop column _phonenumber 9. Delete record from table if not put ‘where’, will delete all record delete fron customer where country='Thailand’ 10. Delete table drop table customer 11. Change data type alter table customer alter column phonenumber_varchar(1@)a | 1. Create database create database SaleOrder 2._ Use the database use SaleOrder 3. Create tables create table dbo.customer { CustomeriO int NOT null primary key, CustomerFirstName varchar(50) NOT null, CustomerLastName varciar(50) NOT nu! CustomerAddress varchar(50) NOT null, CustomerSuburb varchar(50) cull, CustomerCity varcharS0) NOT null CustomerPostCode char(4) null CustomerPhoneNumber char(12) nul ) create table dbo inventory ( InventoryID tinyint NOT null primary key, InventoryName varchar(50) NOT null, InventoryDescription varchar(255) nul, 7 create table dbo employee | EmployeeID tinyint NOT nul primary key, EmployeeFirstName varchar|50) NOT nul, EmployeeLastName varchar(50) NOT null EmployeeExtension char) nul } create table dbo sale ( SalelD tinyint not null primary key, CustomeriD int not null references customer(Customer!D), InventoryID tinyint “ot null references Inventory(InventorylD), EmployeeID tinyint not null references Employee|EmployeelD), SaleDate date not nul, SaleQuantity int not nu!l, SaleUnitPrice smallmoney not null ) 4, Check what table inside select * from information schema.tables 5. View specific row =-top: show only the first two select top 2 * from customer -top 40 percent: also means show the first two select top 40 percent * from customer & View specifie column —Sort result (by default is ascending) select customerfirstname, customerlastname from customer order by customerlastname desc select customerfirstname, customerlastname from customer order by 4, 2, 3 dese -- Order By Based on column no. without typing column name ~distinct: only show unique value select distinct customerlastname from customer order by customerlastname‘Save table to another table into file_name: save result in another table (BASE TABLE) select distinct customerlastname into temp from customer order by customerlastname select * from temp ~-see the table (data type will remain) Like (search something) ~ (underscore sign) _is only specific for one character only (percent sign) % represents zero, one, or multiple characters select * from customer where customerlastname like ' 1%! In (search something) — search multiple items select * from customer where customerlastname in ‘Brown’, ‘Michae'’ im’) 10. > (search something) select © from customer where customerlastname > ‘Brown’ or customerlastname>'Cross’ rT <> (Not Equal) select * from customer where customerlastname <> 'Brown! 12 IS NULL = check null values select * from customer where customerlastname IS NULL FET IS NOT NULL select * from customer where customerlastname IS NOT NULL 14. between select © from sale where saleunitprice between 5 and 10 not include 5 & 10 15, count returns the number of rows in a table ~ AS means aliasing, temporary giving name to a column/ table select count(*) as [Number of Records] from customer where customerfirstname like 'B%! 16. ‘sum select sale employeeid EmployeeFirstName, EmployeelastName , counl(") as [Number of order] sum(salequantity) as [Total Quantity] from saleemployee where sale employeeid - employee employeeid group by sale.employeeid EmployeeFirstName, EmployeeLastName v7. count month select month(saledate) as [Month], count ( * ) as [Number of sale] sum(salequantity"saleunitorice as [Total Amount] from sale group by month(saledate) 18. max SELECT MAX(Salary) FROM EmployeeSalary 18, min SELECT MIN(Salary) FROM EmployeeSalary 20. average SELECT AVG (Salary) FROM EmployeeSalary21. having SELECT JobTitie, COUNT( JobTitle) FROM EmployeeDemographics ED JOIN EmployeeSalary ES ON ED.EmployeeID - ES.EmployeeID GROUP BY JobTitle HAVING COUNT(JobTitle) > 1 SELECT JobTitle, AVG(Salary) FROM EmployeeDemographics ED JOIN EmployeeSalary ES ON ED.EmployeeID = ES.EmployeeID GROUP BY JobTitle HAVING AVG(Salary) > 45000 ORDER BY AVG(Salary) 22. Change data type temporary for use — CASTlexpression AS datatype(length)) SELECT CAST(*2@17-08-25 @8:60:00.008' AS date) ~- CONVERT(data_type(length), expression, style) SELECT CONVERT (date, ‘2017-08-25 00:€0:00.000' ) 23. CASE Statement SELECT FirstName, LastName, Age, CASE WHEN Age > 30 THEN ‘Old* WHEN Age BETWEEN 27 AND 3@ THEN ‘Young’ ELSE ‘Baby" END FROM EmployeeDemographics ED WHERE Age IS NOT NULL ORDER BY Age SELECT FirstName, LastName, JobTitle, Salary, CASE WHEN JobTitle = ‘Salesman’ THEN Salary + (Salary *.10) WHEN JobTitle = ‘Accountant’ THEN Salary + (Salary *.05) WHEN JobTitle = 'HR' THEN Salary + (Salary *.000001) ELSE Salary + (Salary *.@3) END AS SalaryAfterRaise FROM EmployeeDemographics ED JOIN EmployeeSalary &S ON ED. EmployeeID - ES.EmployeeID 24, Partition By ~returns a single value for each row SELECT FirstName, LastName, Gender, Salary, COUNT (Gender) OVER (PARTITION BY Gender) AS TotalGender FROM EmployeeDemographics ED JOIN EmployeeSalary &S ON ED. EmployeeID - ES.EmployeeID Fete Ne Oendet Sly Tele a es oes 2 Medtn Pain Fomale 600 Stay Hutson Milo $8000 5 Dwgtt —ScewleNale £9000 a ee)~-- only need to run this on next time EXEC Temp_Employee 27. Subquery == Subquery in Select SELECT EmployeeID, Salary, (SELECT AVG(Salary) FROM EmployeeSalary) AS AllAvgSalary FROM EmployeeSalary -- with Partition By SELECT EmployeeID, Salary, AVG(Salary) OVER () AS AllavgSalary FROM Employeesalary Enpoyeel0 Soy atavSday 1 [too «sa00 a7ano 3 10) esKO 47000 5 105 sonco 47500 = Subquery in From SELECT a.EmployeeID, AllAvgSalary FROM (SELECT EmployeeID, Salary, AVG(Salary) OVER () AS AllavgSalary FROM EmployeeSalary) a ORDER BY a.EmployeeID > AaSiny 7908 7003 om = Subquery in Where SELECT EmployeeID, JobTitle, Salary FROM EmployeeSalary WHERE EmployeeID in (SELECT EmployeeID FROM EmployeeDemographics WHERE Age > 30) SELECT EmployeeID, JobTitle, Salary FROM EmployeeSalary WHERE Salary in (SELECT Max(Salary) FROM EmployeeSalary)SQL JOINS Inner Join Outer Join Self Join Cross Join [ Left Outer Join | [ rer outer ti | Full Outer Join getting data from multiple tables {explicit join - without using join command) select © from inventory sale where sale inventoryid-inventory.inventoryid select inventoryname, saledate seleunitprice salequantity,salequantity saleunitprice as [Total amount] from sale inventory where sale inventoryid=inventory inventoryid group by sale inventoryid inventoryname saledate salequantity saleunitprice order by inventoryname getting data from multiple tables (implicit join - using join command) inner join select * from inventory inner join sale on sale.inventoryid-inventory.inventoryid select inventoryname,saledate seleunitprice salequantity saleunitprice’ salequantity as [Total Amount] from inventory inner join sale on sale inventoryid-inventory inventoryid order by inventoryname ~full cuter join (shows everything) select sale inventoryid inventoryname from inventory full outer join sale on sale inventoryid-inventory inventoryid where sale inventoryid is NUL25. String Functions = wane apace Select EnployeeID, TRIN(EmployeeID) AS IDTRIM FROM EmployeeErrors Select EmployeeID, RTRIM(EmployeeID) as IDRTRIM FROM EmployeeErrors Select EmployeeID, LTRIM(EmployeeID) as IDLTRIM FROM EmployeeErrors -- Replace Select LastName, REPLACE(LastName, ‘- Fired’, ‘*) as LastNameFixed FROM EmployeeErrors ~ Substring Select Substring(err. FirstName, 1,3), Substring (dem.FirstName,1,3), Substring(err.LastName,1,3), Substring (dem. LastName, 1,3) FROM Employeerrors err JOIN EmployeeDemographics dem ‘on Substring(err.FirstName,1,3) = Substring (dem.FirstName, 1,3) and Substring(err.LastName,1,3) = Substring (dem. LastName, 1,3) =- UPPER and LOWER CASE Select firstname, LOWER(firstname) from EmployeeErrors Select Firstname, UPPER (FirstName) rom EmployeeErrors” 26. Stored Procedure ‘CREATE PROCEDURE aa Employee AS DROP TABLE IF EXISTS #temp_employee Create table #temp_employee ( JobTitle varchar(100), EmployeesPeriob int , Avgage int, AvgSalary int ) Insert into #temp_employee SELECT JobTitle, Count (JobTitle), Avg(Age), AVG(salary) FROM EmployeeDemographics emp JOIN EmployeeSalary sal ON emp. EmployeeID - sal.£mployeeID vhere EESEGMNMMMNEEN --- nake sure to change this An this script from original above group by JobTitle Select * From #temp_employee Go;~left join (might have NULL value, since some inventory might not have sales) select inventory inventoryid inventoryname from inventory left join sale on sale inventoryid-inventory inventoryid left join select inventory inventoryid inventoryname from inventory left join sale on oe aaa wentoryid ~ without join: use subquery select inventoryid inventoryname from inventory where inventoryid not in (select inventoryid from sale) right join select sale.inventoryid,inventoryname from inventory right join sale on sale.inventoryid- inventory inventoryid 3. Selfoin ~commonly used in processing hierarchy =inner join Staff Table -employeeiD _employeefirstname _employeelastname _manageriD 1001 Tan Mei Ling NULL 1002 Kelvin Koh 1001 1003 Amin Wong 1002 select E,employeeID, E.employeefirstname»" 'sE.employeelastname as [Full Name], E.manageriD, , M.employeefirstname:' '+M.employeelastname as [Manager Name] from staff E inner join staff M ‘on ExmanageriD = M.employee!DOutput: employeelD FullName — managerID_ managerName 1002 Kelvin Koh 1001 Tan Mei Ling 1003 Amin Wong. 1002 Kelvin Koh ~left outer join (list all the employees) select E,employee!D, E.employeefirstnames’ '-E.employeelastname as [F Name], E.manageriD, , M.employeefirstnames' '+M.employeelastname as [Manager Name] from staff E left outer join staff M ‘on E.manageriD = M.employeeID Output: employeelD FullName — manageriD_ managerName 1001 Tan Mei Ling 1002 Kelvin Koh 1001 Tan Mei Ling 1003 Amin Wong 002 Kelvin Koh 4. Gross Join -generate all combination of records (all possibility) (Cartesian Product) ‘select * from inventory cross join inventory2 Preset TEFTyOIN Tabs 8 ON Akey Be SQL JOINS ‘@ ici JOIN roses ON Axey= BK ‘SiR ay 1s NU FULL OUP JOIN Taam ficterJor8 Tas TULLOUTEROR Tien 9 ON Abs hey Duns esenSQL UNIONS 1. Union ~allow you to combine two tables together (but the no. of columns & each column’s data types for 2 tables must be match) ~don't need common key, only need common attributes ~merge, not showing duplicate record select cust_Iname,cust_fname from customer union select cust_Iname,cust_fname from customer_2 2. Union all ~merge, but show you everything, even the duplicate record select cust_Iname,cust_fname from customer union all select cust_Iname,cust_fname from customer_2 Intersect ceep only the rows in common to both query not showing duplicate record select cust_iname,cust_fname from customer intersect select cust_Iname,cust_fname from customer_2 ‘select ¢.cust_Iname,c.cust_fname from customer c,customer_2 2 where ¢ cust_Iname=c2.cust_iname and c.cust_fname=c2.cust_fname 4. Except ~generate only the records that are unique to the CUSTOMER table ‘select cust_iname,cust_fname from customer except select cust_Iname,cust_fname from customer_2 ~use subquery select cust_iname,cust_fhame from customer where(cust_iname) not in (select cust_Iname from customer_2) and (cust_fname) riot in (select cust_fname from customer_2) 10Table & View View table (view will be updated when update base) ~view is a result set of SQL statements, exists only for a single query select customerfirstname customerphonenumber, inventoryname, saledate salequantity saleunitprice,salequan as [Total Amount] from customer inner join sale on customer.customerid-sale.customerid inne join inventory on sale inventoryid-inventory inventoryid »customerlastname as [Customer Name] *saleunitprice Temp table (temp will NOT be updated when update base) ~a single hashtag (H) sign must be added in front of their names used to store data temporarily, physically created in the Tempdb database can perform CRUD, join, and some other operations like the persistent database tables DROP TABLE IF =xISTS #teap_Enployee Create table #EGRpLEWPLOVEE ( JobTitle varcnar 100), EnployeesPerdob int, avenge int AvgSalary int Insert INTO #temp_Enployee SELECT JobTitle, Count (JobTitle), Avg(Age), AVG(salary) FROM EmployeeDemographics emp 301 Employeesalary sal ‘ON emp. EnployeeID ~ sal.mployeeID group by JobTitle SELECT * FROM temp Employee CTE (Common Table Expression) —create temporary result set which is used to manipulate the complex sub-queries data ~created in memory rather than Tempdb database, so cannot create any index on cre i SELECT FirstName, LastName, Gender, Salary, COUNT(Gender) OVER (PARTITION BY Gender) AS TotalGender FROM EmployeeDemographics ED JOIN Employeesalary ES ON ED. EnmployeeID = ES. EmployeeD WHERE Salary > '45000" SELECT FirstName, LastName, Gender, TotalGender FROM CTE_Employee WHERE TotalGender = (SELECT MIN(TotalGender) FROM CTE_Employee) Duplicate Table select customerfirstname~’ -customerlastname as [Customer Name] , customerphonenumber, inventoryname saledate,salequantity saleunitprice salequantity ‘ saleunitprice as Total Amount iteistomerRe from customer inner join sale on customer customerid=sale customerid inner join inventory on sale inventoryid-inventory.inventoryid order by customerfirstname ~' + customerlastname inventoryname| SQL RANKS 1, ROW_NUMBER() get a unique sequential number for each row ~get fifferend|ranks for the row having similar values SELECT *, ROW_NUNBER() OVER(ORDER BY Salary DESC) SalaryRank FROM EnployeeSelary EnpiyeciD_obTio Sot Satnankc 1 [rons 7] Ragan anager 08000 1 2 Tm Seman 89000 2 4 1008 Salesman 40000 5100 Acsrutant 6 100 NULL 7 1001 Seeman 50007 8 MULL Salesman 2000 8 100 emumant 2000 101007 Sigler Raters $1000 10 11100 Fcopicrist 3600011 2. RANK() specify rank for each row in the result set ~Use PARTITION BY to performs calculation on each group ~each subset get rank as per Salary in descending order USING PARTITION BY. SELECT *, RANK() OVER (PARTETHONIBYIJOBTHELE ORDER BY Salary DESC) ‘SalaryRank FROM Employeesalary ORDER BY JobTitle, SalaryRank _EmpyeoiO Joi ‘Say Sayan 1 [roto we 470 + 2 lope Aeenuntant 470001 3 ton _Accuintant__—_—42000_ 2 a 300007 5 loo Recoptonst = 3000 61008 Rego Manager 650001 7100s Sakeman 30007 8 toe = Saksman 4000 2 8 1001 Salesman 4500 1 Nyu__saesan 43000 4 111007 Supe Relators 21000 = get SAME] ranks for the row having similar values SELECT *, RANK() OVER(ORDER BY Salary DESC) SalaryRank FROM Employeesalary ORDER BY SalaryRank FropelD bite ‘Say Salayfonk 1 [10057 | Regenaltanager 65000 1 21003 Sama amo 2 210s oH 0000 3 41008 Seman ‘2000 5 100% Acsuniant 8 wom 8 NULL Saesman 43000 8 8 1000 estat 2000 9 10 1007 Supper Fatons 41000 10 11 1002 Roceptenst 3600011wrneieon 3. DENSE_RANKQ ~ if have duplicate values, SQL assigns different ranks to those rows. will get the same rank for duplicate or similar values SELECT *, DENSE RANK() OVER(ORDER 8Y Salary DESC) SalaryRank FROM Enployeeselary ORDER BY SalaryRank Empoye0iD Joorite Salary Salanftank 1 [1006] Regina Manager 1 2 60d Satesmen 3105 HR 4 1008 ——_—Satosman 51008 Aeccunant 6 wo NULL 71001 Satesman 8 NULL Satesman 8 1009 Accountant 10 1007 Supple Retains 11 1002 Recaptonst RANK() DENSE_RANK() SELECT *, SELECT *, RANK() OVER(PARTITION BY JobTitle ORDER BY Salary DESC) SalaryRank FROM EmployeeSalary ORDER BY Jobritle, SalaryRank DENSE_RANK() OVER(PARTITION BY JobTitle ORDER BY Salary DESC) SalaryRank FROM EnployeeSalary ORDER BY JobTitle, Salarynank EenpkyeIO _JooTte Say Sainte me aa 5 eee 1 470001 1 fio NULL 47000 1 2 “100i Accoutani 47000 1 3 joan aa 3 1000 Accouiant «42000 2 3 pecouniant 2 4 105 HR 0000 1 ‘ HR 1 5 1002 Rocoptonist 300001 5 Rocoptenst 3 6 1006 __Fogonalanagor_65000_1 6 FegonalNangger 1 71003 Safesman 6300 7 Saesman 8 1001 Saesman 49004 8 1001 Salesman 9 1008 Salesman a0 9 1008 Salesman to_NULL___Salosman___ 42000 10_MUL__Soesman 111007 Supper Rabons 41000 “T T1100 —— Sin Rao = skip a rank if have similar values -~ nalittsins-the rank and does pot ive any: sep for the values 3B4, NTILE() = can specify required how many group of result, and it will rank accordingly, SELECT *, NTILE(3) OVER(ORDER By Salary DESC) SalaryRank FROM Employeesalary ORDER BY SalaryRank; 7 2 Saewran 650001 3 10s HR so000 1 oe ‘4 10o1__ssesman__ 45000 1 $100 Saran 45000"? © 1004 Accomm’ $7000 2 === Group2 7 0 NL tn 2 NUL seman 20022 [> tas —~"heorrant tan 3] 102 Besoin aD 9 cnes 10 1007 Super eltons $1002. 3 11102 ___—Receptonst 96000 3 USING PARTITION BY SELECT =, NTILE(3) OVER(PARTITION BY JobTitle ORDER BY Salary DESC) Salarykank FROM EnployeeSalary ORDER BY JobTitle, SalaryRank Emel Jobe Sszy_Sotyark 1 foo 70001 2108 Aeoutant 0001 31000 ___Acscuntnt_a200_2 41005 He S000 7 5 1002 Reoptonst e000. 1 x Group 1 8 ' Group 2 : Group 3 7 141. Write the query to show the invoice number, the customer number, the customer name, the invoice date, and the invoice amount for all customers with a customer balance of $1,000 or more. invoice_num.c.cust_num.¢ cust_Iname.c.cust_fname.inv_date.inv_amount from customer ¢; invoice where ccust_num=invoice cust_num and cust_balance>=1000 select invoice_numc cust_num,cust_Inames" “scust_fname as [Name] inv_date,iny_amount from customer ¢ join invoice i fon c.cust_num=i cust_num where cust_balance>=1000 2. ISNULL(expression, value) ~expression: to test whether is NULL, value: to return if expression is NULL ~ParceliD is same, but UniquelD is different; can assume that if the ParcellD is same, the Property Address will be same Select a.ParcelID, a.PropertyAddress, b.ParcelID, b.PropertyAddress, ISNULL (a. PropertyAddress ,b.PropertyAddress ) From NashvilleHousing a JOIN NashvilleHousing b on a.ParcellD - b.ParcelID AND a. [UniqueID] <> b.[UniqueID] Where a.PropertyAddress is null ~ Update record Update a SET PropertyAddress ~ ISNULL (a. PropertyAddress,b.PropertyAddress ) From NashvilleHousing a JOIN NashvilleHousing b on a.ParcelID = b.ParcelID AND a. (UniqueID] <> b.[UniqueID] Where a.PropertyAddress is null 3. Split by delimiter 4 SUBSTRING(string, start, length) CHARINDEX(substring, string, start) © LEN(string) SELECT PropertyAddress, SUBSTRING(PropertyAddress, 1, CHARINDEX(",", PropertyAddress) -1 ) as Address » SUBSTRING (PropertyAddress, CHARINDEX(',", PropertyAddress) ~ 1, LEN(PropertyAddress)) as City From NashvilleHousing aaress oy if T] aoe FoxcHASEDR —GOOOLETISVILLE 2 1K2 FOKCHASE DOR, GOODLETISVILLE 1822 FOXCHASEOR —GOOOLETISVILLE 3 WEEFOXCHASE DR. GOODLETISVILLE T84FOXCHASE DR GODDLETISVILLE 41653 FOXCHASEOR, GOODLETTSVILLE 1859 FOXCHASEOR _GOOOLETISVILLE 8 1820 FOXCHASEOR,GOODLETTSVILLE 1820 FOXCHASEOR © GOOOLETISVILE ALTER TABLE NashvilleHousing Add PropertySplitAddress Nvarchar(255); ALTER TABLE NashvilleHousing Add PropertySplitcity Nvarchar (255) ;4 PARSENAME(‘object_name! object_piece) “numbering works from right to left * REPLACE(string, old_string, new_string) '8y Fang ing Sham e Update NashvilleHousing SET PropertySplitAddress = SUBSTRING(PropertyAddress, 1, CHARINDEX(",", PropertyAddress) -1 ) Update NashvilleHousing SET PropertySplitCity - SUBSTRING(PropertyAddress, CHARINDEX(",", PropertyAddress) + 1 , LEN(PropertyAddress) ) Select OwnerAddress., PARSENAME (REPLACE (OwnerAddress, * >» 3) »PARSENAME (REPLACE (OwnerAddress, ',", '.') , 2) »PARSENAME (REPLACE (OwnerAddress, ',, '.') , 1) From NashvilleHousing Mocournrans) __ocokmnae)_flocourn rane) TEVILETW | os FoxcwsEDR —GOODLETTSVLLE TN Wek FOXCHASEDR GOOOLETTSVALE TA 186 FOXCHASEDR _GOODLETISVLLE 7H 1WSt FOXOAASEDR GOOOLETTSVLLE TN 1853 FOXGHASEDR —GOODLETISVLLE 7W 1uz9 FOXCHASE DR, COOOLETTSVALLE TM 1220 FOXCHASEDR _GOODLETISVLLE TN ALTER TABLE NashvilleHousing Add OwnerSplitaddress Nvarchar (255) ; ALTER TABLE NashvilleHousing Add OwnerSplitCity Nvarchar(255); ALTER TABLE NashvilleHousing Add Ownersplitstate Nvarchar(255) ; Update NashvilleHousing SET OwnerSplitAddress = PARSENAME (REPLACE (OwnerAddress "at tet) 3) Update NashvilleHousing SET OwnerSplitCity = PARSENAME(REPLACE(OwnerAddress, ',", "s*) > 2) Update NashvilleHousing SET OwnerSplitState = PARSENAME (REPLACI "Ay, 4) wnerAddress, ',* 5. Remove duplicate records WITH RowNumCTE AS( Select *, ROW_NUMBER() OVER ( PARTITION BY ParcelID, PropertyAddress , SalePrice, SaleDate, LegalReference ORDER BY UniqueID) as row_num From NashvilleHousing order by ParcelID ) =-DELETE Select * From RowNumCTE Where row_num > 2 Order by PropertyAddress
You might also like
Hourglass Workout Program by Luisagiuliet 2
PDF
76% (21)
Hourglass Workout Program by Luisagiuliet 2
51 pages
12 Week Program: Summer Body Starts Now
PDF
87% (46)
12 Week Program: Summer Body Starts Now
70 pages
Read People Like A Book by Patrick King-Edited
PDF
58% (81)
Read People Like A Book by Patrick King-Edited
12 pages
Livingood, Blake - Livingood Daily Your 21-Day Guide To Experience Real Health
PDF
77% (13)
Livingood, Blake - Livingood Daily Your 21-Day Guide To Experience Real Health
260 pages
Cheat Code To The Universe
PDF
94% (79)
Cheat Code To The Universe
34 pages
Facial Gains Guide (001 081)
PDF
91% (45)
Facial Gains Guide (001 081)
81 pages
Curse of Strahd
PDF
95% (467)
Curse of Strahd
258 pages
The Psychiatric Interview - Daniel Carlat
PDF
91% (34)
The Psychiatric Interview - Daniel Carlat
473 pages
The Borax Conspiracy
PDF
91% (57)
The Borax Conspiracy
14 pages
The Secret Language of Attraction
PDF
86% (107)
The Secret Language of Attraction
278 pages
How To Develop and Write A Grant Proposal
PDF
83% (542)
How To Develop and Write A Grant Proposal
17 pages
Penis Enlargement Secret
PDF
60% (124)
Penis Enlargement Secret
12 pages
Workbook For The Body Keeps The Score
PDF
89% (53)
Workbook For The Body Keeps The Score
111 pages
Donald Trump & Jeffrey Epstein Rape Lawsuit and Affidavits
PDF
83% (1016)
Donald Trump & Jeffrey Epstein Rape Lawsuit and Affidavits
13 pages
KamaSutra Positions
PDF
78% (69)
KamaSutra Positions
55 pages
7 Hermetic Principles
PDF
93% (30)
7 Hermetic Principles
3 pages
27 Feedback Mechanisms Pogil Key
PDF
77% (13)
27 Feedback Mechanisms Pogil Key
6 pages
Frank Hammond - List of Demons
PDF
92% (92)
Frank Hammond - List of Demons
3 pages
Phone Codes
PDF
79% (28)
Phone Codes
5 pages
36 Questions That Lead To Love
PDF
91% (35)
36 Questions That Lead To Love
3 pages
How 2 Setup Trust
PDF
97% (307)
How 2 Setup Trust
3 pages
The 36 Questions That Lead To Love - The New York Times
PDF
94% (34)
The 36 Questions That Lead To Love - The New York Times
3 pages
100 Questions To Ask Your Partner
PDF
80% (35)
100 Questions To Ask Your Partner
2 pages
Satanic Calendar
PDF
25% (56)
Satanic Calendar
4 pages
The 36 Questions That Lead To Love - The New York Times
PDF
95% (21)
The 36 Questions That Lead To Love - The New York Times
3 pages
SQL Notes
PDF
50% (4)
SQL Notes
16 pages
14 Easiest & Hardest Muscles To Build (Ranked With Solutions)
PDF
100% (8)
14 Easiest & Hardest Muscles To Build (Ranked With Solutions)
27 pages
Jeffrey Epstein39s Little Black Book Unredacted PDF
PDF
75% (12)
Jeffrey Epstein39s Little Black Book Unredacted PDF
95 pages
1001 Songs
PDF
69% (72)
1001 Songs
1,798 pages
SQL Note - by Fang Ying
PDF
No ratings yet
SQL Note - by Fang Ying
18 pages
The 4 Hour Workweek, Expanded and Updated by Timothy Ferriss - Excerpt
PDF
23% (954)
The 4 Hour Workweek, Expanded and Updated by Timothy Ferriss - Excerpt
38 pages
Zodiac Sign & Their Most Common Addictions
PDF
63% (30)
Zodiac Sign & Their Most Common Addictions
9 pages
SQL Ultimate Cheat Sheet
PDF
100% (1)
SQL Ultimate Cheat Sheet
8 pages
Select As From: Firstname (First Name) Employeedetail
PDF
100% (1)
Select As From: Firstname (First Name) Employeedetail
7 pages
SQL Subquery
PDF
100% (1)
SQL Subquery
57 pages
Questions (SQL) : Saved To The Database. DCL
PDF
No ratings yet
Questions (SQL) : Saved To The Database. DCL
15 pages
Lecture 7 - Using Subqueries To Solve Queries
PDF
No ratings yet
Lecture 7 - Using Subqueries To Solve Queries
19 pages
Dax 1
PDF
No ratings yet
Dax 1
27 pages
SQL Case When Statement
PDF
100% (1)
SQL Case When Statement
10 pages
Rank, Dense Rank
PDF
100% (1)
Rank, Dense Rank
3 pages
Power BI
PDF
No ratings yet
Power BI
47 pages
Python Complete Notes
PDF
100% (1)
Python Complete Notes
64 pages
Homemadejobs Blogspot Com
PDF
No ratings yet
Homemadejobs Blogspot Com
21 pages
Cleaning Dirty Data With Pandas & Python - DevelopIntelligence Blog PDF
PDF
No ratings yet
Cleaning Dirty Data With Pandas & Python - DevelopIntelligence Blog PDF
8 pages
Difference Between Temporary Table and Table Variable in SQL Server
PDF
No ratings yet
Difference Between Temporary Table and Table Variable in SQL Server
2 pages
Power BI Vinay Tech
PDF
No ratings yet
Power BI Vinay Tech
11 pages
SQL-cheatsheet
PDF
100% (1)
SQL-cheatsheet
1 page
Example:: Transact-SQL Functions 135
PDF
No ratings yet
Example:: Transact-SQL Functions 135
104 pages
DAX CheetSheat
PDF
No ratings yet
DAX CheetSheat
20 pages
Subqueries
PDF
No ratings yet
Subqueries
22 pages
Table Partitioning in SQL Server
PDF
No ratings yet
Table Partitioning in SQL Server
11 pages
PL-300
PDF
No ratings yet
PL-300
13 pages
DA-100 Questions
PDF
No ratings yet
DA-100 Questions
9 pages
3 - Power BI - Query Editor - Row Transformation
PDF
No ratings yet
3 - Power BI - Query Editor - Row Transformation
43 pages
4 - Power BI - Query Editor - Text Transformation
PDF
100% (1)
4 - Power BI - Query Editor - Text Transformation
88 pages
DAX Interview Questions 1697470822
PDF
No ratings yet
DAX Interview Questions 1697470822
14 pages
SQL - Date Functions: Name Desc Ription
PDF
No ratings yet
SQL - Date Functions: Name Desc Ription
17 pages
Correlated Subquery
PDF
100% (1)
Correlated Subquery
13 pages
DB Questions
PDF
No ratings yet
DB Questions
32 pages
Advanced DAX - Dynamic Segmentation, Time Comparisons, Cross Sell and Averages - Power BI Experience
PDF
100% (1)
Advanced DAX - Dynamic Segmentation, Time Comparisons, Cross Sell and Averages - Power BI Experience
39 pages
Real-Time CDC With SAP Data Services and SAP Replication Server
PDF
No ratings yet
Real-Time CDC With SAP Data Services and SAP Replication Server
20 pages
PBI - Bhaskar
PDF
No ratings yet
PBI - Bhaskar
9 pages
SQL Queries and PL/SQL
PDF
No ratings yet
SQL Queries and PL/SQL
92 pages
SQL Practice Question Set - 4
PDF
No ratings yet
SQL Practice Question Set - 4
1 page
Ssas Real Time Interview Questions and Answers
PDF
No ratings yet
Ssas Real Time Interview Questions and Answers
7 pages
Visualization in Power BI
PDF
No ratings yet
Visualization in Power BI
30 pages
SSIS Tutorial: SQL Server 2005 Integration Services Tutorial
PDF
No ratings yet
SSIS Tutorial: SQL Server 2005 Integration Services Tutorial
28 pages
Power Query
PDF
No ratings yet
Power Query
4 pages
SQL Interview Questions and Answers G
PDF
No ratings yet
SQL Interview Questions and Answers G
67 pages
MySQL Aggregate Function
PDF
No ratings yet
MySQL Aggregate Function
35 pages
SQL Notes
PDF
No ratings yet
SQL Notes
96 pages
IntervalMatch and Slowly Changing Dimensions
PDF
No ratings yet
IntervalMatch and Slowly Changing Dimensions
22 pages
SQL Questions
PDF
100% (1)
SQL Questions
28 pages
SQL Solved Questions
PDF
No ratings yet
SQL Solved Questions
23 pages
Cognos Interview Questions - Very Good
PDF
No ratings yet
Cognos Interview Questions - Very Good
7 pages
SQL - 4 Group Functions F22
PDF
No ratings yet
SQL - 4 Group Functions F22
30 pages
Tableau Interview Questions 1
PDF
No ratings yet
Tableau Interview Questions 1
22 pages
Oracle Forms Reports Besant Technologies Course Syllabus
PDF
No ratings yet
Oracle Forms Reports Besant Technologies Course Syllabus
6 pages
SQL Interview Questions -1
PDF
No ratings yet
SQL Interview Questions -1
68 pages
SQL Lab Assignment
PDF
No ratings yet
SQL Lab Assignment
6 pages
PYTHON notes by devaraj
PDF
100% (1)
PYTHON notes by devaraj
40 pages
SSIS
PDF
No ratings yet
SSIS
8 pages
Querying Microsoft SQL Server
PDF
No ratings yet
Querying Microsoft SQL Server
3 pages
Power Bi Points To Keep in Resume
PDF
No ratings yet
Power Bi Points To Keep in Resume
4 pages
Various MDX Queries
PDF
No ratings yet
Various MDX Queries
13 pages
SQL Interview
PDF
No ratings yet
SQL Interview
5 pages
Micro Strategy Material
PDF
No ratings yet
Micro Strategy Material
298 pages
SQL Guide
PDF
No ratings yet
SQL Guide
16 pages
Placementdrive 1706154092999283
PDF
No ratings yet
Placementdrive 1706154092999283
6 pages
SQL Cheat Sheet GDS
PDF
No ratings yet
SQL Cheat Sheet GDS
16 pages