Using System;Using System.Collections.Generic;Using System.Linq;Using System.Text;Using System.Threading.Tasks;Namespace reading of the database{Using System.Data;Using System.Data.SqlClient;Class SQLHelper{static string sqlconn = system.configuration.configurationmanager.connectionstrings["Sqlconn"]. ConnectionString;Executes the query result returns the first column value of the first columnpublic static Object ExecuteScalar (String sql, params sqlparameter[] sp){using (SqlConnection conn =new
Tags: data types date dates Conversions har bspnvlmisround NVL function is a null-value conversion function one, NVL (expression 1, expression 2) If expression 1 is a null value, NVL returns the value of expression 2, otherwise returns the value of expression 1. The purpose of this function is to convert a null value (NULL) into an actual value. The value of its expression can be numeric, character, and date. But the data type of expression 1 and expression 2 must be the same typ
Label: --display dates in a specific format
SelectEname,to_char (HireDate,'YYYY "Year" MM "month" DD "Day"') fromEMP;--Exclude Duplicate rows
Select distinctDeptno,job fromEMP;SelectDeptno,job fromEMP;--handling NULL using the NVL function
Selectename, SAL,COMM,NVL (comm,0.00), Sal+NVL (Comm,0) fromEMP;--handling NULL using NVL2
SelectENAME,SAL,
Basic query:Copy codeThe Code is as follows:-- Query Information of all employeesSelect * from emp;-- Set the row widthSet linesize 120;-- Set the column width to the width of four digitsCol empno for 9999;-- Set the column width. a indicates the string length of eight digits.Col ename for a8-- Set pageSize to display 30 records per pageSet pagesize 30;-- SQL supports arithmetic expressions. Note: if an expression contains null values, the entire expression is empty.Select empno, ename, sal, sal
where sal> any (select sal from emp where deptno = 30) -- Multi-column subquery select ename, sal, deptno, job from emp where (deptno, job) = (select deptno, job from emp where ename = 'Smith ') update empset sal = 1500, comm = 30 where ename = 'clark' select ename, sal, comm from emp where ename = 'clark' select ename, sal, comm, deptno from emp where (sal, nvl
Basic query:
View plain
-- Query Information of all employees
Select * from emp;
-- Set the row width
Set linesize 120;
-- Set the column width to the width of four digits
Col empno for 9999;
-- Set the column width. a indicates the string length of eight digits.
Col ename for a8
-- Set pageSize to display 30 records per page
Set pagesize 30;
-- SQL supports arithmetic expressions. Note: if an expression contains null values, the entire expression is empty.
Select empno, ename, sal, sal * 12,
connection in Java)7. select ename | 'afasjkj 'from emp; // string connection8. select distinct deptno from emp; // clear the repeated values of the deptno Field9. select distinct deptno, job from emp; // remove the values that are repeated with the two fields.10. select * from emp where deptno = 10; // (conditional filter query)11. select * from emp where empno> 10; // greater than the filtering Value12. select * from emp where empno 13. select * from emp where ename> 'CBA'; // string comparis
Plan. It takes seven days to evaluate the mission.Development. Demand AnalysisAs an event manager. I want to know the score of each team in order to generate rankings.. Generate Design Documents. Specific design. Specific code public static class SqlHelper {private static readonly string constr = "server=.; Database=itcast;integrated Security=true "; public static int ExecuteNonQuery (String sql, params sqlparameter[] pams) {using (SqlConnection conn = New SqlConnection (
gracefully. Indicates the end of the parallel code, ending other processes other than the main process.–? The serial code can still run on the main process (rank = 0), but no more MPI functions (including Mpi_init ()).3. int mpi_comm_size (Mpi_comm Comm, int* size)–? Gets the number of processes size.–? Specifies a communication child that also specifies a set of processes that share the space that comprise the group of the communication.–? Gets the
database statementSqlcommand comm = new sqlcommand (insertstr, Conn );Comm. Parameters. Add (New sqlparameter ("@ image_data", sqldbtype. Image); // Add a parameterComm. Parameters ["@ image_data"]. value = filebyte; // assign a value to the parameterComm. Parameters. Add (New sqlparameter ("@ image_content_type", sqldbtype. varchar, 50 ));Comm. Parameters ["@ i
Card detection CD and write protection WP
Sdks do not have uniform physical specifications for WP, CD, and comm.But for Pin 1 ~ 9 have unified specifications. pin sequence is 8, 7, 6, 5, 4, 3, 2, 1, 9
Card detection CD and write protection WP achieves mechanical connection between WP and CD to distinguish whether the card is inserted and whether there is write protection.Comm is the common pin of WP and CD, So If comm is connected to the location, W
. select * from emp where deptno = 10; // (conditional filter query)11. select * from emp where empno> 10; // greater than the filtering Value12. select * from emp where empno 13. select * from emp where ename> 'CBA'; // string comparison. In fact, the AscII value of each character is compared, which is the same as the string in Java.14. select ename, sal from emp where sal between 800 and 1500; // (between and filter, including 800 1500)15. select ename, sal,
Oracle condition selection statement and loop statement
Oracle Condition Selection statements (IF, CASE), LOOP statements (LOOP, WHILE, and FOR), and sequential control statements (GOTO, NULL ).1. IF condition selection statement1.1 simple condition judgment
DECLAREV_sal NUMBER (6, 2 );BEGINSELECT sal INTO v_sal FROM emp WHERE lower (ename) = lower (' name ');IF v_sal UPDATE emp SET sal = v_sal + 200 WHERE lower (ename) = lower (' name ');End if;END;
1.2 dual-condition Branch
DECLAREV_comm NUMBE
authorization
REVOKE permission 1,..., permission n ON database. * FROM username @ IP address;
Revokes the specified permissions of a specified user on a specified database.
Example: revoke create, ALTER, drop on mydb1. * FROM user1 @ localhost;
Revoke the create, alter, and drop permissions of user1 users on the mydb1 database.
4. View Permissions
Show grants for username @ IP Address
View permissions of a specified user
5. delete a user
Drop user us
dual;
-- General functions complete some functions-- Nvl function if the first parameter is null, the second parameter is used.Select comm from scott. emp;Select nvl (comm, 0) from scott. emp;
-- Replace null comm with 0 to calculate the annual income.Select ename, sal, comm, (sal +
),
@outcheck char (3) OUTPUT
as
if exists (SELECT * from UserInfo where fullname= @infullname and password= @inpassword)
Select @outcheck = ' Yes '
Else
Select @outcheck = ' No '
Note: Here is a stored procedure with three parameters, the first parameter @infullname, this is an input parameter, (user name), the second parameter @inpassword, is also an input parameter, (password), the third parameter @outcheck, this is an output parameter, (whether this user exists), the word "outp
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.