Word SQL
Word SQL
SELECT EMPNO, ENAME, SAL DENSE_RANK() OVER (ORDER BY SAL DESC) AS RN FROM Emp.
5. VIEWS
IT IS A LOGICAL REPRESENTATION OF ONE OR MORE TABLES. A view can also be considered as a virtual
table. View cant store the data.
6. DELETE
7. TRUNCATE
REMOVES ALL THE ROWS FROM THE TABLE [DDL]. YOU CAN’T SPECIFY WHERE CLAUSE.
8. DROP
HAVING COUNT(EMAIL)>1
10. Normalization in SQL?
Normalization divides the larger table into smaller tables and links them using relationship.
SELECT A.ID, A.NAME AS EMP_NAME, B.NAME AS MANAGER_NAME FROM EMP_TB A LEFT JOIN
EMP_TB B ON A.M_ID=B.ID;
SELECT *,RANK() OVER(PARTITION BY CLASS ORDER BY MARKS DESC) AS RNK FROM STUDENT;
13.I want sum of salary and name and name start with like H and salary<5000…?
select sum(salary),name from employee where name like '%h' groupby name having sum(salary)<5000;
STRUCTURE OF SQL
1. CREATE , SELECT, FROM , WHERE , GROUP BY , 1.HAVING , ORDER BY.
Order of execution of Sql query…?
PROCEDURE:- FUNCTIONS:-
2.IT DOES NOT SUPPORT CLIENT 2.IT SUPPORT CLIENT SERVER ARCHITECTURE.
SERVER ARCHITECTURE.
3.NORMALIZATION IS NOT 3.NORMALIZATION IS AVAILABLE IN RDBMS.
AVAILABLE IN DBMS.
4.IT ALLOWS ONE USER AT A TIME 4. IT ALLOWS MORE THAN ONE USER AT A TIME.
5. HIERARCHIAL ARRANGEMENT OF DATA 5. STORES DATA IN THE FORM OF ROWS AND COLUMNS.
22.How to get the name from the email address in sql server...?
1.Scalar functions:- May or may not have parameters,but always return a single value.The
returned value can be of any data type,except text,ntext,image,cursor,and timestamp.
2.Inline table-valued functions:-
3.Multi-statement table-valued functions.
25.While creating stored procedure what are the functions used in sql server...?
END;
GO
WITH CTE AS (
Write a query to calculate the even and odd records from a Table...?
Select * from tablename where MOD (columnname,2)=0;
Select * from tablename where MOD (columnname,2)=1;
Mod function is used to get the reminder from a division.
Write a query to display the first and the last record from the
table...?
Select * from tablename where columnname=(select min(columnname) from
tablename );
Select * from tablename where columnname=(select max(columnname) from
tablename );