sql語句工具
A. 主要用於創建執行和測試trans sql語句的工具是
你說的是Transact-SQL嗎?sqlserver提供的工具就是:SQL Server Management Studio
B. plsql如何使用
1、PL/SQL Developer記住登陸密碼
在使用PL/SQL Developer時,為了工作方便希望PL/SQL Developer記住登錄Oracle的用戶名和密碼;
設置方法:PL/SQL Developer 7.1.2 ->tools->Preferences->Oracle->Logon History , "Store history"是默認勾選的,勾上"Store with password" 即可,重新登錄在輸入一次密碼則記住了。
2、執行單條SQL語句
在使用PL/SQL Developer的SQL Window時,按F8鍵,PL/SQL Developer默認是執行該窗口的所有SQL語句,需要設置為滑鼠所在的那條SQL語句,即執行當前SQL語句;
設置方法:PL/SQL Developer 7.1.2 -->tools->Preferences-->Window types ,勾上"AutoSelect Statement" 即可。
3、格式化SQL語句
在使用PL/SQL Developer的SQL Window時,有時候輸入的SQL語句太長或太亂,希望能用比較通用的寫法格式話一下,這樣看起來會好看些,也好分析;
使用方法:選中需要格式化的SQL語句,然後點擊工具欄的PL/SQL beautifier按鈕即可.
4、查看執行計劃
在使用PL/SQL Developer的SQL Window時,有時候輸入的SQL語句執行的效率,分析下表結構,如何可以提高查詢的效率,可以通過查看Oracle提供的執行計劃;
使用方法:選中需要分析的SQL語句,然後點擊工具欄的Explain plan按鈕(即執行計劃),或者直接按F5即可。
5、調試存儲過程
在使用PL/SQL Developer操作Oracle時,有時候調用某些存儲過程,或者調試存儲過程;
調用存儲過程的方法:首先,在PL/SQL Developer左邊的Browser中選擇Proceres,查找需要調用的存儲過程;然後,選中調試的存儲過程,點擊右鍵,選擇Test,在彈出來的Test scrīpt窗口中,對於定義為in類型的參數,需要給該參數的Value輸入值;最後點擊上面的條數按鈕:Start debugger 或者按F9;最後點擊:RUN 或者Ctrl R
C. 填入表名列名條件自動生成SQL語句的工具
ALTER proc [dbo].[proc_insert] (@tablename varchar(256),@where varchar(max))
as
begin
set nocount on
declare @sqlstr varchar(MAX)
declare @sqlstr1 varchar(MAX)
declare @sqlstr2 varchar(MAX)
select @sqlstr='select ''INSERT '+@tablename
select @sqlstr1=''
select @sqlstr2=' ('
select @sqlstr1= ' VALUES ( ''+'
select @sqlstr1=@sqlstr1+col+'+'',''+' ,@sqlstr2=@sqlstr2+name +',' from (select case
-- when a.xtype =173 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
when a.xtype =36 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =127 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(20),'+a.name +')'+' end'
when a.xtype =104 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(1),'+a.name +')'+' end'
when a.xtype =175 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =61 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
when a.xtype =106 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
when a.xtype =62 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
when a.xtype =56 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(11),'+a.name +')'+' end'
when a.xtype =60 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end'
when a.xtype =239 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =108 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
when a.xtype =231 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =59 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
when a.xtype =58 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
when a.xtype =52 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(12),'+a.name +')'+' end'
when a.xtype =122 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end'
when a.xtype =48 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(6),'+a.name +')'+' end'
-- when a.xtype =165 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
when a.xtype =167 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
else '''NULL'''
end as col,a.colid,a.name
from syscolumns a
where a.id = object_id(@tablename) and a.xtype <>189 and a.xtype <>34 and a.xtype <>35 -- and a.xtype <>36
AND COLUMNPROPERTY(a.id, a.name, 'IsIdentity') <> 1
)t order by colid
select @sqlstr=@sqlstr+left(@sqlstr2,len(@sqlstr2)-1)+') '+left(@sqlstr1,len(@sqlstr1)-3)+')'' from '+@tablename + ' where '+@where
-- print @sqlstr
exec(@sqlstr)
set nocount off
end
D. 大家用什麼工具格式化SQL語句
用這個工具格式化:https://www.toolsou.com/app/sql,支持mysql、Oracle、sql server
E. 想學習SQL語言,該用什麼軟體來練習SQL語句
電腦上裝個Mysql。然後再裝Navicat for MySQL
或者SQLyog這個csdn上也有漢化的