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;
--
Tags: Easy GROUP by INF nbsp Name query ever find usingQuery statement: SQL Sever query statement; 1. Query all fields: SELECT * FROM UserInfo 2. Conditional screening (such as querying the username in userinfo) Select UserName from UserInfo WHERE statement: SELECT * from UserInfo where sex= ' man ' and major= ' comp
Transact --- SQL advanced query (I)1: Multi-Table query and flute Product2: table alias usage3: use SQL server statistical functions4: Use the group by clause to query groups
A: Multi-Table query and deyr ProductSo far, we have us
",$conn);$sql= "SELECT * from ts1 where name '% Smarter New Employee% '";$result=mysql_query($sql);Echo' ; while($row=Mysql_fetch_assoc($result)){Echo' ;Echo' $row[' ID ']. ' $row[' name ']. ' $row[' Image ']. ' ;Echo' ;}Echo' ;Mysql_close($conn);}? >PHPif(!Empty($_post[' Development '])){$conn=mysql_connect("localhost", "root", "root");if(!$conn){ die(' Could not connect the database! ');}mysql_query("SET
This article describes (advanced) how to connect PHP to the database to achieve the most basic addition, deletion, modification, and query (process-oriented) details. For more information, see section 1. connect PHP to the MySQL database.
2. add data to the database
First, I created a user table in the beyondweb_test database for demonstration.
SQL statement:
, advanced query (an excel file can be exported or an interface for generating various reports is reserved. However, we also provide a dedicated query module for some special workflows, such as turning positive, leaving, and attendance. For example, the resignation module described in this article is divided into three sub-modules: New resignation information, resigned upon approval, and terminated resignat
attention to the place in MySQL involved in multiple table query, need to query according to the situation, want to use which connection way more efficient.
1. Cross-linking (cartesian product) or inner join [INNER | CROSS] JOIN
2. Left outer join or right [OUTER] Join note Specifies the join condition where, on,using, the OUTER.
PS: Basic Join usage
First w
650) this.width=650; "Src=" http://images2017.cnblogs.com/blog/139239/201709/139239-20170911112105313-661504674. JPG "width=" 423 "height=" 235 "style=" border:0px; "/>This time we learned the last article of how to write a better SQL query series.Time complexity and large o symbolsThrough the first two articles, we have a certain understanding of the query plan.
Directory
[10 days to learn about Linq to SQL] day 1-Basic Knowledge
[10 days to learn about Linq to SQL] The next day -- data context
[10 days to learn about Linq to SQL] The third day -- Data Query
[10 days to learn about Linq to SQL
keywords, used to implement the group query;--having: Conditions, optional keywords, are used to filter the results after grouping;--order by: field, optional keyword, used for sorting operations;Note: Queries without conditions, that is, column queries, can be a field, multiple fields, constants, or expressions in a table.Example:--Query all contents of student tableSELECT * from student;--Check the names
length Col ename for a20;//set character field lengthSQL syntax considerations: Keywords cannot be abbreviated, cannot wrap, end with a semicolon!View all commands for Sqlplus:? TopicQuery SQL statement syntax:SELECT [Distinct]*|column_name|expr|alias from TableNameQuery employee number, name, salary, bonus, annual salary:Note that the bonus field has a null result and can be resolved by considering an empty function, namely: NVL (A, B), if A is null
Tags: sql thinkphp phpA Query methodthinkphp provides three basic query methods: String conditional query, indexed array condition query, and object barQuery. In most cases, it is recommended to use indexed arrays and object metho
1 query statement 1.1 obtain the unique record -- distinct obtain the employee's unique salary status SQL statement is as follows. SQLgt; selectdistincte. employee_name,
1 query statement 1.1 obtain the unique record -- distinct obtain the employee's unique salary status SQL statement is as follows. SQLgt; select disti
pushed to PP -.-)
The compute, compute by, and into keywords cannot appear in the view.
The view cannot be created on a temporary table.
View cannot query full-text indexes
A simple example of creating a view:
Create view v_test_view1asselect Top 100 * From HumanResources. Employee
After the view is created, you can access the view as you access the table:
Select * From v_test_view1
In management studio, I prefer this m
pushed to PP -.-)
The Compute, compute by, and INTO keywords cannot appear in the View.
The View cannot be created on a temporary table.
View cannot query full-text indexes
A simple example of creating a View:
CREATE VIEW v_Test_View1ASSELECT TOP 100 * FROM HumanResources.Employee
After the view is created, you can access the view as you access the table:
SELECT * FROM v_Test_View1
In Management studio, I prefer this method when creating a vie
Basic query: -- Query Information of all employees select * fromemp; -- set the row width setlinesize120; -- set the column width to the width of four digits
Basic query: -- Query Information of all employees select * from emp; -
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 sup
number according to the correlation condition According to the SELECT * from Item WHERE owner_id in (...) and category_id=1//both use the on condition during the query.
$users= User::find ()->joinwith (' books ')all (); Copy code if the join operation is not used, either with or directly with the property to access the association.
This time the on condition is used as the Where condition. //SELECT * from user WHERE id=10
$user= User::findone (10);
operation functions
Concat, length, substr, instr, trim, replace, lpad, rpad
Tutorial 12: operate string functions
Character operation functions:
Case-sensitive operation functions
Lower, upper, and initcap in upper case
String operation functions
Concat, length, substr, instr, trim, replace, lpad, rpad
The purpose of this experiment is to master the functions of common string operations.
String case-sensitive operations
SQL> Select lower (ename), up
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.