Shortcut Function Shortcut Function
ALT+BREAK Cancel a query CTRL+SHIFT+F2 Clear all bookmarks
ALT+F1 Database object information CTRL+SHIFT+INSERT Insert a template
ALT+F4 Exit CTRL+SHIFT+L Make selection lowercase
CTRL+A Select all CTRL+SHIFT+M Replace template parameters
CTRL+B Move the splitter CTRL+SHIFT+P Open
CTRL+C Copy CTRL+SHIFT+R Remove comment
CTRL+D Display results in grid format CTRL+SHIFT+S Show client statistics
CTRL+Delete Delete through the end of the line CTRL+SHIFT+T Show server trace
CTRL+E Execute query CTRL+SHIFT+U Make selection uppercase
CTRL+F Find CTRL+T Display results in text format
CTRL+F2 Insert/remove bookmark CTRL+U Change database
CTRL+F4 Disconnect CTRL+V Paste
CTRL+F5 Parse query and check syntax CTRL+W Window selector
CTRL+G Go to line CTRL+X Delete
CTRL+H Replace CTRL+Z Undo
CTRL+I Index Tuning Wizard F1 Help for Query Analyzer
CTRL+K Display/hide execution plan F2 Move to next bookmark
CTRL+L Display execution plan F3 Repeat last search
CTRL+N New query window F4 Object Search
CTRL+O Connect F5 Execute a query
CTRL+P Print F6 Switch between query and result panes
CTRL+R Show/Hide results pane F8 Show/hide Object Browser
CTRL+S Save SHIFT+F1 Transact-SQL help
CTRL+SHIFT+0 Show options SHIFT+F2 Move to previous bookmark
CTRL+SHIFT+C Comment out code SHIFT+TAB Decrease indent
CTRL+SHIFT+DEL Clear the active Editor pane SHIFT+F6 Switch panes
CTRL+SHIFT+F Save results to file TAB Increase indent
Friday, June 27, 2008
Query for Display second max salary of Employee
select * from newemployee em where
2=(select count(distinct sal) from newemployee e where e.sal<=em.sal).
2=(select count(distinct sal) from newemployee e where e.sal<=em.sal).
Thursday, June 26, 2008
How we can count duplicate entery in particular table against Primary Key ? What are constraints?
The syntax in the previous answer (where count(*) > 1) is very questionable. suppose you think that you have duplicate employee numbers. there's no need to count them to find out which values were duplicate but the followin SQL will show only the empnos that are duplicate and how many exist in the table:
Select empno, count(*)
from employee
group by empno
having count(*) > 1
Generally speaking aggregate functions (count, sum, avg etc.) go in the HAVING clause. I know some systems allow them in the WHERE clause but you must be very careful in interpreting the result. WHERE COUNT(*) > 1 will absolutely NOT work in DB2 or ORACLE.
Sybase and SQLServer is a different animal.
Posed By:Jagannath Karmakar
Select empno, count(*)
from employee
group by empno
having count(*) > 1
Generally speaking aggregate functions (count, sum, avg etc.) go in the HAVING clause. I know some systems allow them in the WHERE clause but you must be very careful in interpreting the result. WHERE COUNT(*) > 1 will absolutely NOT work in DB2 or ORACLE.
Sybase and SQLServer is a different animal.
Posed By:Jagannath Karmakar
Delete Duplicate Rows using Single Line Sql
with t as (select row_number()over(partition by asid,imagepath order by asid) as rnum from amz_image)
delete from t where rnum>1
delete from t where rnum>1
Subscribe to:
Posts (Atom)
