Conn Scott/tiger;grant insert,update,delete on EMP to System;conn system/orcl1234;create or replace VIEW V_empas select em Pno,ename,job,hiredate,deptno from Scott.emp;IndexIn order to improve the speed of the query, when the user is not satisfied with the query speed and needs to adjust the performance of the database, it is preferred to establish an index.CREATE INDEX idx_ename on employee (ename, Sal DESC);Proper use of indexes can improve the speed of data retrieval and can create indexes on
%rowtype; --Define variables that can store an EMP table row of data begin SELECT * into Rowvar_emp from EMP where empno=7369; /* Output Employee information */ dbms_output.put_line (' Employees ' | | rowvar_emp.var_ename| | ' The position is ' | | rowvar_emp.var_job| | ' wages are ' | | Rowvar_emp.var_sal); end; /Output Result:Employee Smith's job is clerk, salary is 2712.5-----------------------------------define variables and constants-----------------------------------1. Defining variablesC
used; Temporary tables cannot be used; The operation inside the function cannot affect the external environment; Cannot return result set through select; Not update,delete, database tables; 3. Must return a scalar value or table variable Custom functions are generally used in a high degree of reuse, simple function, the fight against the strong place. Second, the stored procedure 1. Cannot return table variable 2. Fewer restrictions, you can perform operations on database tables, you can return
--Pre-defined exception: The system has declared an exceptionDECLAREV_name EMP. Ename%type;BEGINSELECT ename to V_name from EMP WHERE EMPNO = 1234;EXCEPTIONWhen No_data_found ThenDbms_output. Put_Line (' No data found ');When OTHERS ThenDbms_output.put_line (' other anomalies ');END;--Non-predefined exception: System exception, the system does not declare itDECLAREE_fkexception EXCEPTION;PRAGMA Exception_init (e_fkexception,-2291);BEGININSERT into EMP VALUES (8888, ' Tom ', ' Clerk ', 7902,sysda
transmission System (DTS), the third is the system, and the fourth makes a commentary on the interface of the intermediate device. Everyone creates the objects they want in isolation, and almost no code is checked. Perhaps the designer prescribes that Sproc98765 accept certain parameters and return a result, and then the other members of the team correspond to it. In any rigorous development organization, checking code and factorization is an integral part of a project, but for some strange rea
SQL database programming technology in JSPI. SQL review1. SQL statements are divided into two types: DDL (Data Definition Language) and DML (Dat Manipulation Languge, Data operation Language ). The former mainly defines the logical structure of data, including the definition of tables, views and indexes. DML mainly que
Programming | skills | data | database | How to delete a column in a table repeating columns Yes, for instance.
Table [table1]
ID name1 aa2 bb3 cc1 Aa2 cc
I think the last watch is like this.
ID Name 1 AA2 bb3 cc
Reply:
Save the record in a temporary table #t, save a duplicate record, and then save the record in the temporary table #t back into the original table, noting that "SELECT DISTINCT Id,class,name" contains all the fields you need, othe
-defined type. Basic Data type description Binary integer integer type data (note: binary binary) number[(precision, fractional)] can represent integers and floating-point numbers CHAR [(maximum length)] string, up to 32 767 bytes in length Long string Long raw-to- VARCHAR2 (maximum length) consistent with VARCHAR2 in the database DATE and date-in the database Boolean evaluates to True and False In addition to the basic types described above, PL/SQL a
information, student informationWhere score information. Student Number = Student information. School NumberOrder by average grade descComments--Open the database of Student achievement management systemUse Student performance management system/*View student number. Name, gender, class, home addressand sex for Female student information*/Select school number, name, gender, class, home addressFrom Student informationwhere sex = "female"(3) operatorArithmetic operatorsComparison operatorsAssignme
Dependency of Spark SQLSpark SQL Portal: SqlContextOfficial website Reference Https://spark.apache.org/docs/1.6.2/sql-programming-guide.html#starting-point-sqlcontextWritten for several different languages.Spark SQL Portal: HivecontextSqlContext vs HivecontextHow Spark SQL w
"Original Hadoopspark hands-on Practice 10" Spark SQL Programming Basics and hands-on practice (bottom)Goal:1. Deep understanding of the principles of spark SQL programming2. Use simple commands to verify how spark SQL works3. Use a complete case to verify how spark SQL work
segment......When conditional expression Results n ThenStatement Segment N[ELSE statement Segment]END case;Example: Show week based on input 1-7DECLAREV_week Number:= S;BEGIN CaseV_week when 1 ThenDbms_output. Put_Line ('Monday'); when 2 ThenDbms_output. Put_Line ('Tuesday'); when 3 ThenDbms_output. Put_Line ('Wednesday'); when 4 ThenDbms_output. Put_Line ('Thursday'); when 5 ThenDbms_output. Put_Line ('Friday'); when 6 ThenDbms_output. Put_Line ('Saturday'); when 7 ThenDbms_outp
Tags: complete no font index. SH His loop sts self-incrementI. Package and package body Package: A set of subroutines, variable definitions stored in a database. A subroutine in a package can be called by another package or subroutine. However, if you declare a local subroutine, you can call that local subroutine only in the block that defines the local subroutine. It has the characteristics of object-oriented programming language and is the encapsula
Label:Compared to the mysql5.1 Handbook, this paper summarizes the SQL programming of the past few days, mainly related to triggers, stored procedures, rights Management, master-slave separation and so on, the right when the expert, please skip. The flip-flop is to trigger the execution of a specific SQL statement before or after the specified data table is added
package. Sql> Create or ReplacePackage Sp_package is
2 procedureSp_pack_pro1 (id_invarchar2, name_invarchar2); 3 functionSP_PACK_FUN1 (mon_in Number, id_invarchar2)return Number; 4 End; 5 /Package created SQL>SQL> Create or ReplacePackage Body Sp_package is
2 procedureSp_pack_pro1 (id_invarchar2, name_invarchar2) is
3 begin
4 UpdateMyTestSetName
Tags: BSP operation ABC begin class CTI color name data Sql> Select * frommytest; ID NAME PASSWD SALARY----- -------------------- -------------------- ---------------------------------------------------------------- ----------------
1Gagaga123 -
2Gaodingle!!!!123
In SQL Server Big Data query, avoid the query efficiency slow, discard hardware reasons and version reasons, only from the perspective of SQL statement analysis.I. SQL statement performance is not standard, the main reasons for a few points:1. Index not built, search results in full table scan2. Indexes are built, but index invalidation is caused by non-indexing,
Tags: design SQL records one handle ORACL information transaction handleIn a PL/SQL program, cursors are often used for transactions that handle multiple rows of records.(i) The concept of cursorsTo handle SQL statements, Oracle must allocate a region called the context to process the required information, including the number of rows to be processed, a pointer t
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.