1. query all tables in SQL:
Select TABLE_NAME FROM database name. INFORMATION_SCHEMA.TABLES Where TABLE_TYPE = 'base table' after execution, you can see the names of all tables created by yourself in the database.
2. query all tables and columns in SQL:
Select dbo. sysobjects. name as Table_name, dbo. syscolumns. name AS Column_name FROM dbo. syscolumns inner join dbo. sysobjects ON dbo. syscolumns. id
, A few string functions can also use binary and varbinary data types. In addition, some strings can also process text, ntext, and image data types.1. Classification of string functions:(1). Basic string functions: upper, lower, space, replicate, stuff, reverse, ltrim, rtrim.(2). string search function: charindex, patindex.(3). Length and analysis functions: datalength, substring, right.(4). conversion functions: Asch, Char, STR, soundex, difference4.
In fact, this is also a problem at work. To tell the truth, I am not willing to do it myself. I also want to write statements for queries, but I have not thoroughly studied this kind of information,Write SQL statements in JavaProgramAt the same time, I chose to be lazy.
First, if it is golden, of course there is no need to say that the Direct Write statement is similar to select. If it is PL/SQL, it is not
1. Query all tables in sql:
Select table_name from database name. Information_schema. Tables Where table_type= ' BASE table ' is executed, you can see the names of all the tables in the database that belong to you
2. Query all tables and columns in sql:Select Dbo.sysobjects.name as TABLE_NAME, dbo.syscolumns.name as column_name from Dbo.syscolumns INNER JOIN dbo.sysobject s on dbo.syscolumns.id = Dbo.sysobjects.id Where (dbo.sysobjects.xtype = '
String functions are used to process data values in a column. They are usually of the bytes type.
1. ASCLL (character) converts a specific character into an ASCII code with a positive number.
For example, select ASCII ('A'), and the result is 65.
2. CHAR (int): Convert the ASCII code to the corresponding character. The result is CHAR (1 ).
For example, select CHAR (65). The result is.
3. CHARINDEX (str1, str2) returns the starting position of str1 in str2 for the first time. If str1 does not app
MS SQL Server Query optimization methodThere are many reasons for the slow speed of queries, which are common1, no indexes, or no indexes (this is the most common problem with query slowness, is the flaw in programming)2, I/o throughput is small, creating a bottleneck effect.3, no computed columns are created causing the query to be not optimized.4, Low memory5, network speed is slow6, query out the amount of data is too large (you can use multiple qu
(%) any sequence of zero or more charactersproc SQL; Select Ffid, name, address from sasuser.frequentflyers where like ' % P%place ' * Spaces are also included in the string; Quit;3.6:using the sounds-like (=*) Operator to Select a spelling variationThe Sounds-like (=*) operator uses the SOUNDEX algorithm to compare each value of a column (or other
match the brackets, you should enclose them in square brackets as well. For example, the following statement returns all sites whose description contains a percent semicolon:
SELECT site_name from Site_directory WHERE site_desc like '%[%]% '
Match pronunciation
Microsoft SQL has two functions that allow you to match a string by pronunciation. function Soundex () assigns a phonetic code to a string, and
1. query all tables in SQL:Select TABLE_NAME FROM database name. INFORMATION_SCHEMA.TABLES Where TABLE_TYPE = 'base table' after execution, you can see the names of all tables created by yourself in the database.2. query all tables and columns in SQL:Select dbo. sysobjects. name as Table_name, dbo. syscolumns. name AS Column_name FROM dbo. syscolumns inner join dbo. sysobjects ON dbo. syscolumns. id = dbo. sysobjects. id Where (dbo. sysobjects. xtype = 'U') AND (NOT (dbo. sysobjects. name LIKE '
Topic: Consumers from Madrid with fewer than 3 orders
Build table:
Copy Code code as follows:
SET NOCOUNT ON--When SET NOCOUNT is on, the count is not returned (representing the number of rows affected by Transact-SQL statements). Returns the count when SET NOCOUNT is off
Use SY
Go
If OBJECT_ID (' dbo. Orders ') is not null
DROP TABLE dbo. Orders
Go
If OBJECT_ID (' dbo. Customers ') is not null
DROP TABLE dbo. Customers
Go
CREATE
Label:The optimization of SQL statements is to convert poorly performing SQL statements into the same performance SQL statements with the same purpose.AI automatic SQL optimization uses AI technology to automatically rewrite SQL statements to find the best-performing equival
. substr (string, start, count)Substring, starting from start, countSQL> select substr ('123', 13088888888) from dual;
Substr ('--------08888888
12. Replace ('string', 's1', 's2 ')String: the character or variable to be replaced.String to be replaced by S1String to be replaced by S2SQL> select Replace ('He love you', 'hes', 'I') from dual;
Replace ('heloveyou', 'hes', 'I ')------------------------------I love you
13. soundexReturns a string with the same pronunciation as a given string.SQL> Crea
Tags: nbsp play clob Introduction ring LAN Solution Help SED 1. Brief introduction Oracle DATABASE11GR1 introduces SQL Planmanagement (SPM), a set of new tools that allow DBAs to capture and maintain discretionary SQL statements to run the best plan, limiting refresh optimizer statistics. There has been an application change. Even the impact of a database version number upgrade. This article helps to unders
).Grammatical structure: datalength (expression)Return value: Returns bigint if the expression data type is a varchar (max), nvarchar (max), or varbinary (max) data type. Otherwise, int is returnedUse: Select Datalength (' i ') –2 SOUNDEXReturns a four-character code to evaluate the similarity of two stringsGrammatical structure: SOUNDEX (' character ')Use:Select Soundex (' ABCDE ')--a120Select
Abstract: In the PL/SQL development process, SQL, PL/SQL can be used to meet most of the requirements. However, in some special cases, standard SQL statements or DML statements in PL/SQL cannot meet your needs. For example, dynamic table creation or an uncertain operation mu
11. Microsoft SQL server network settingsOverview of Network ServicesSQL Server application interfaceNetwork Connection LibraryNetwork components and SQL server performanceNetwork MonitoringSummaryAfter you install Microsoft SQL Server, you must set its network settings. Up to now, you or your Microsoft Windows NT or Windows 2000 system administrator may have set
Label:The more written the SQL script, the more often it feels that writing is too inefficient, regardless of the speed of the typing. When I personally write SQL scripts, I will at least arrange the SQL format to be easy to read, because others will read your SQL, whether in the program or in the script file, good typ
Use of PL/SQL DBMS_ SQL package (1) (Study Notes), pldbms_ SQL
Dbms_ SQL packageThe dbms_ SQL package is another method provided by the system to use dynamic SQL:Follow these steps to use the DBMS_ SQL package to implement dynamic
Tags: style io ar color using SP on data artString function ASCIIReturns the ASCII encoding of the first letter of the stringSelect ASCII (' name ')Select ASCII (name) from XueshengSelect *from Xuesheng where ASCII (name) >=200CHAR--Convert the ASCII code to the corresponding characterSelect CHAR (13)--EnterCHARINDEXSearches for another expression in one expression and returns its starting position (returns ' 0 ' if not found)Select CHARINDEX (' EFG ', ' abcdefgh ')Select CHARINDEX (' 8 ', math)
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.