Delete from TT Where T.T.%% PHYSLOC%%
Not in(Select min(%%PHYSLOC%%)
from T.T group by EID)
Note: PHYSLOC: Physical location of row[Just like row id]
So tera data The below 2 ways are recommended
1.Create B like A
2.Load duplicate of “A” TO “B”
3.Drop ”A”
4.Rename “B” TO “A”
Note: If we want to complete row duplications, then take a set table
Inclined to build a profession as SQL Server Developer? Then here is the blog post on, explore SQL Server Training
We use the identify column to generate the sequence in tera data and so the server create set table test (party ID Integer Generated always as identify Start with 1 Increment by1 Min value 2147483647 Max value 2147483647 No cycle), party name varchar (30)) Primary index(party id);
Insert into test2(‘Vinay’)
Generate always As identify, it will not in insert user given input value
Generated by default as identity, it takes user given input value also. Create set table test 11 (party id integer generated by default as identify(Max value3), Party name varchar(30)) Primary index(party id);
Generally, this conditional expression only where and having clauses (In, not in, BETWEEN AND, Not BETWEEN AND, IS NULL, IS NOT NULL, EXISTS, NOT EXISTS, LIKE, ALL, SAMS, ANY, etc---)
Among in and exists which gives good performance
Ans: Always use exists, because it gives a good performance (once finds the match it stores the process)
Display All the name where % is the 2nd character
Ans: Select * From party where party name like –z %% ESCAPE ‘Z’
Select * From party where party name like –z-%
Select * From party where party names like%
in Select * From party where party id in (1,2,3) (or) Sel * From party where party id = 1 or party id = 2 or party id =3
Exist not Exists: To the values existed it display the result
Rows and columns
Query inserts a query subquery, in this case, one query is outer Query, the other is inner Query
Always we refer to inner Queries by using conditional expressions, like, in, Exists, not in, not Exists, etc….. Operators.
Query insert another Query is called simple sub – Query
Ex: Display employee details, if the dept id available in department table Select* From emp where exists (select dept no from dept): Select* From emp where dept id In (select dept id from dept): Select* From emp where exists (select dept no from dept where emp. dept no= dept.dept no):
Sub- Query within another sub- Query is called Nested sub- Query
Ex: Display dept details where Dept ids available in employee table where empid available in the employee address table and those address are valid address in party address table Select* From dept where deptid in (Select dept id from emp where empid in) (Select dept id from emp _address where emp address in) (Select address from party _Address) ) )
Simple sub Query | Correlated sub Query |
1.Inner Query executed First | 1.Out Query executed First |
2.Inner Query executed only one time Ex: Finding 2nd Maximum Select max(Party income)From party where party income not in(Select mad(Party income)from the party) |
2.Inner Query executed many times (According to Query) [Based on outer Query (for loop)] Ex: Finding 2nd maximum select a party income from the party a were 1st (Select count(Distinct(b: party income))from party b where a. party income(b. party income) |
Note: For with max salary need to place n-1 in place of 1 Collated
A30000 |
|
COUT0 | B30000 20000 25000 |
20000 | <T<F <T | 2 | 3000020000 25000 |
250000 | <T<F <T | 1 | 3000020000 25000 |
Note:
Syntax: Select column/* From Table A union/union All/Intersect/except Select column/* From Table B
The number of columns and order of the column data type should be the same in both the data sets it doesn’t bother about the column name.
it merges the rows from to data sets including duplicate
merges the rows from to data sets including duplicate
Take common rows from the path the data set
Take exclusive rows from the 1st dataset[Not including matching or other data set row]
Note: Union doesn’t allow duplicate value union all allows duplicate value Sel EID, EName From emp Union ok union All or intersect or except Sel empid, emp name From emp-Address
Ex: Using Group by clause We have to take the group by clause individual Query wise rather than entire set operations wise Sel Eid, ename from emp group by eid, ename UNION Sel empid, exlame From emp- Address group by empid; emp name
Sel EID,E Name From emp UNION Sel empid, emp name From emp-Address Intersects Sel EID, Ename from emp10 Except Sal eid, e name from emp
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.