To query the list of 3rd employees
The original data table is as follows:Create Table Test
(
Name varchar (12 ),
Myvalue int
)
Insert into testSelect 'zhang ', 80Union select 'wang ', 98Union select 'li', 100Union select 'zhao', 92Union select
50 common SQL statements
Student (S #, Sname, Sage, Ssex) Student tableCourse (C #, Cname, T #) CurriculumSC (S #, C #, score) Orders tableTeacher (T #, Tname) Instructor table
Problem:1. query the student ID of all students whose score is higher
Student (s #, sname, sage, ssex) Student tableCourse (C #, cname, T #) CurriculumSC (s #, C #, score) Orders tableTeacher (T #, tname) Instructor table
Problem:1. query the student ID of all students whose score is higher than that of the "002"
Student (s#,sname,sage,ssex) Student tableCourse (c#,cname,t#) timetableSC (s#,c#,score) score sheetTeacher (t#,tname) Teacher's TableProblem:1, Query the "001" Course than "002" course scores of all students of the school number;
Copy Code
GrammarUse CAST:
CAST (expression as data_type)
Use CONVERT:
CONVERT (data_type[(length)], expression [, style])
ParametersExpression
Is any valid Microsoft SQL Server expression. For more information, see expressions.
Data_type
The data
With its excellent performance, low cost and rich resources, MySQL has become the preferred relational database for most Internet companies. Although excellent performance, but the so-called "good horse with a good saddle", how to better use it, has
The bibliography used in the user verification is recorded in the datasheet, and now I want to take out all the bibliographies, using distinct and group by to get the results I want, but I find that the return results are arranged in a different
A warning was found today when an index was added to the test environment
Root@test 07:57:52>alter Table article drop index ind_article_url;
Query OK, 144384 rows Affected (16.29 sec)
records:144384 duplicates:0 warnings:0 root@test 07:58:40>
On the Internet to see Eygle wrote about the partition table and local index of the article, feeling summed up very well, special turned over.
Oracle Partitioning technology can greatly improve the performance of queries under certain conditions, so
The selectivity of an index refers to the ratio of the number of different values in the indexed column to the number of records in the table. If there are 2000 records in a tableRecord, the table index column has 1980 different values, so the
(i) HQL
Hql:hibernate qusery Language, if you're already familiar with it, you'll find it's very similar to SQL. But don't be fooled by appearances, HQL is object-oriented (OO, looking at each object with life's eyes, they are so alive). If you
Querying for different Androidid
Select COUNT (Distinct androidid) from table where dt= ' date ' and androidid are not null and Androidid <> '
and Androidid <> ' null ' and Androidid <> ' null ' and Androidid <> ' _null ' and Androidid <> ' _null '
First, the SQL Aggregate function:The SQL Aggregate function calculates the value obtained from the column and returns a single value.1. AVG () functionThe AVG () function returns the average of a numeric column.Syntax: SELECT AVG (column_name) from
(1) distinguish between having and where:The HAVING clause enables you to specify a filter condition that controls which groups in the query result can appear in the final result. The WHERE clause imposes conditions on the selected column, while the
Previous article for the bug statistical analysis of the preliminaryThis article focuses on the SQL-based Bug statistical analysis method.1. Relationship with time and state:1) Examine the amount of bugs produced per time unit (year, month, day)2)
1, use distinct to weight (suitable for querying the total number of the whole table)There are multiple schools + teachers to contribute, need to count the total number of authorsSelectcount (author)As total from files each author has a lot of
Select version as version from Cbas_eventdata; AllSelect DISTINCT version as versions from Cbas_eventdata; Go heavySelect DISTINCT min (version) as versions from Cbas_eventdata; Take the minimumThe total number of select count (DISTINCT version) as
Common keywords in SQL statements and their explanations are as follows:1Select selects data from a table in the database and two keywords: select from a table in the (from) database. Syntax for select"Field name" from "Table name". 2DISTINCT The
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.