'; V_sql_updateVARCHAR2( $):='UPDATE stuinfo SET name=:1,sex=:2 where Id=:3';BEGIN EXECUTEIMMEDIATE v_sql_update USING v_name,v_sex,v_id;IFSql%ROWCOUNT > 0 Then COMMIT; Dbms_output.put_line ('OK'); END IF; EXCEPTION whenOTHERS ThenDbms_output.put_line (SQLERRM);END;--The binding order in the using is consistent with the order in which the statements are executedSELECT * fromStuinfo;--Dynamic QueryDECLAREStu Stuinfo%ROWTYPE, Cur_r sys_refcursor; v_id stuinfo.id%TYPE:=ID; V_sql_selVARCHAR2( -)
result set based on the specified column.The order BY statement sorts records by default in ascending order.If you want to sort records in descending order, you can use the DESC keyword.
SELECT Company, OrderNumber from Orders ORDER by company
SELECT Company, OrderNumber from Orders ORDER by company, OrderNumber
SELECT Company, OrderNumber from Orders ORDER by company DESC
SELECT Company, OrderNumber from Orders ORDER by company DESC, OrderNumber Desc
INSERT into state
name and value of the attribute. This is called serialization of large object blocks.The advantage of this design is extensibility, and the disadvantage is that SQL cannot get a specified property in such a structure. You have to either the entire BLOB field and the program to interpret the attributes.When you need absolute flexibility, you can use this scenario.If you use EAV, you can first take all of the attributes out and then do other processing
Label:View1. Creation of views ? ? A view is a saved SELECT statement that, when executed, results in a new table, so the view and table are not treated differently in SQL, which means that SQL can do some work on the views. ? ? Because the view does not actually save the data, just save the execution of the SELECT statement, you can save storage space, but for the large data volume of storage, using the vi
of my work was done on common platform architectures, and I had less direct contact with SQL until I changed my company, especially since last year, when the nature of the project changed, I began to start to touch SQL slowly.The length of working hours can determine a person's skill level to some extent, but often the skill level and the actual work output are not necessarily proportional to each other. F
Very good SQL statement learning manual instance version
Very good SQL statement learning manual instance version
Table operations
Example 1 Table STUDENTS in the table teaching management database can be defined as follows:
The Code is as follows:
Create table students (sno numeric (6, 0) NOT NULL
Sname char (8)
Although learning slowly, but also need a step-by-step study.Study notes:1. SQL statement is not case sensitive2. MySQL requires a semicolon;3. Used commands:show databases;//shows how many databases are created database First_lesson;//Create a database using First_lesson;//Use this database to show tables;// Shows how many tables describe person;//display the contents of the header in a tableInsert into wh
the page has value to the servlet? So, his argument should be the name attribute set on the input on the page. The problem is that Gradeid does not match the fault of the newspaper. So why gradename-----gname can run? ---------------------------------------------------------------------------------------- 5. Why does the blank appear when I finish modifying my name? Answer: This question is still an extension of the last question. Just said above, why Gradeid do not match will error, and Gra
Learning Dynamic Performance TableThird article -(1)-v$sq 2007.5.25A specific SQL statement is stored in the v$sql.A statement can map multiple cursor, because the cursor that the object refers to can have different users (such as Example 1). If there is more than one cursor (child cursor) present, the V$sqlarea provides the collection information for all cursors.Example 1 :Here are the following child curs
row to column, how to think about it, here we first in the traditional way, use the case when, and then according to the case when the condition of the sum. The SQL statements are as follows:1 SELECT Empid,2SUM (case when empid=2Then Qty end) as N'customer consumption amount of No. 2nd',3SUM (case when Empid=3then qty End) as N'customer consumption amount of No. 3rd',4SUM (case when empid=4Then Qty end) as N'customer consumption amount of No. 4th',5S
Label:MySQL Learning Note-sql Server mode rollupMySQL servers can operate in different SQL modes, and different modes can be applied to different clients. This allows each application to customize the operating mode of the server according to its own needs. The schema defines which SQL syntax should be supported by MyS
amount ' 2 from Dbo.orders3 GROUP by Empid;But now we want to change the amount of customer consumption into a column, that is, the row to column, how to think about it, here we first in the traditional way, use the case when, and then according to the case when the condition of the sum. The SQL statements are as follows:1 SELECT empid,2 sum (case when empid=2 then qty end) as n ' 2nd customer consumption amount ', 3 SUM (case when Empid=3then qty en
Name Name fieldCREATE TRIGGER employee_updateon employeeafter updateasbeginif (UPDATE name) BeginPrint ' prohibit modification of employee names! ' ROLLBACK TRANSACTION --roll back all operations before this node and proceed to the following statement EndEndVerifyUPDATE Employee SET name= ' XX 'Maintenance backup of the databaseUsing stored procedures to create a backup deviceEXEC sp_addumpdevice ' DISK ', ' comb ', ' E ' \data\comb. BAK 'Deleting a backup deviceEXEC sp_dropdevice ' comb 'To c
=http%3a//www.xdcms.com/index.php%3fm%3dmember%26f%3deditcookie=phpsessid%3d7urapqfnc9cchs31lfu38u0pi4%3b %20member_user%3dxdcms%3b%20member_userid%3d3opener= http/1.1 "200 3View the background database, found that the code is written to the database, do not know whether the storage-type XSS??? In summary, this will send cookie information to the XSS platform each time the page is refreshed.0x02 SQL injection TestThe code of the time background PHP,
ISQLLOCALDB info ["Instance name"] View all, or specify the instance nameVersion vSQLLOCALDB versionTracking TTrace On|off turn on database tracking2. Manage LOCALDB using SQL Server Management Studio (SSMS)Let's say we create a new instance named test01, and then we see this with info: the instance pipeline name: Np:\\.\pipe\localdb#7a15dcd7\tsql\query Here, copy the NP-beginning content to the server name, Then authentication selects Windows to con
If there is a commodity table goods in the database, store more than one item informationWhen executing SQL statementsSELECT * from goods where id = 1;The query result is of course a piece of dataWhen executing SQL statementsSELECT * from goods where id = 1 or 6;What will be the result of the execution???As a result, all commodity information data is queried.This is only a query operation, if it is maliciou
hiredate= ' 1 July-December-80 '--2. Show transformations--2.1to_char () Conversion of datesSelect To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual;--2.2to_char () Conversion of numbersSelect To_char (Sal, ' l9,999.99 ') from EMP--Four. numeric functions--1.round (): RoundingSelect Round (12.45,1) from dual--2.trunc: TruncateSelect Trunc (15.79,1) from dual--Five. General functions--NVL and NVL2 Filter empty functionsSelect Sal*12 Salary, comm Bonus, SAL*12+NVL (comm,0) from EMP;Select Sa
1, SQL In addition to the group by grouping data, SQL also allows filtering groups, rules include those groups, exclude those groups. For example, you might want to list all customers with at least two orders. To do this, the filter must be based on a complete grouping instead of individual rows.Based on the above example, the first time we think about is to filter the data by using where, to get the result
between the department and the employee is stored. The foreign key is just a constraint that guarantees the validity of the data, and the foreign key needs to be built on the relationship column. Script Script execution shortcut keys Ctrl+e SQL is mainly divided into DDL (database definition Language building tables, building libraries and other statements), DML (Database manipulation language) and DCL (Database control Language). CreateTable, alte
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.