1. Management of tables-naming of tables and columns
Must start with a letter
Length cannot exceed 128 characters
Do not use reserved words for SQL Server
Only use the following characters A-z,a-z,0-9,$,#,_ and so on
2. Table Management--supported data types
Character type
Char fixed length, up to 8000 characters (non-Unicode encoding)CHAR (10) has a length of 10 characters, and less space is used to complement
sets are called sub-queries. There are two types of sub-queries: One is to return only a single-valued subquery, at which point it can be used where a single value can be used, when a subquery can be considered a function that has a return value; Another is a subquery that returns a column of values, at which point the subquery can be thought of as a data table that is temporarily present in memory. Create a new department table, an employee table, and a department column number for each
Always think of themselves SQL is very good, did not think of today in the refactoring stored procedure encountered a subquery problem, modified to self-connected after the discovery unexpectedly result is not correct, so have the following test. Suppose the table has the following number of data, ask Query1,query2,query3 query results?
Id
OrderID
Transid
Type
1
1
1
E
2
1
One, database service command linenet start mssqlserver→ to open the native database servicenet stop mssqlserver→ the native database service.... pause ..... → Pause ... continue ..... → ContinueSecond, the file format. mdf format: Database storage file, with only one, to save data.. LDF format: Log file, automatic save operation Record, with and at least one.. sql file: Edit the file for writing the database programming language.III. Implications of
, tableCREATE DATABASE QQ-- creating databasesGoUse QQ-- Select DatabaseGoCREATE TABLE Shuiguo-- Creating Tables(Code int,-- column name + data type, comma delimited Name Char (10),Jiage Decimal (18.2),Chandi Char (10))5 · Delete database drop databases QQ6 • Modify the database name, preceded by the old name, followed by the new name sp_renamedb qq,abc
7 • Backup and restoreBackup of the databaseRight-click database name ---> tasks ---> backup ---> Backup Type Select Full, copy-only backup
Getting Started with databases : The development of database: The stage of-----file Management Stage-----Database system in the stage of human managementThe composition of the Data system:1. Database (data) DB2. Data management system (software) DBMS3. DBA for Database administrators4. Hardware platform5. Software platform3-level mode of the databaseMode in out-of-pattern modeThe simple point of view is that the pattern is the out-of-table mode, which is the physical structure and storage mod
Label:Opening Younger brother is very yearning for those technical Daniel articles, every day to see the blog feel very advanced Daniel, in order to become a technical Daniel, younger brother today also began to write a blog, hope that the elder brother help, and common progress. As the younger brother Caishuxueqian, if there is a bad place to write, forget Daniel pointed out. Thank you so much. . Recent interview found that companies are required to be a good variety of databases, make younger
An operator is an object that receives a message sent by the SQL Server Agent that notifies an operator of an alert message by mail, paging, or network transfer, so that it knows what state the system is in or what event has occurred.
The execution steps for creating an operator are:
(1) Start SQL Server Enterprise Manager, log on to the specified server, click Management in sequence, and then "+" on the
StatementINSERT into dbo. Orders (OrderID, OrderDate, Empid, CustID) EXEC@country='France ';SELECT into statementSELECT OrderID, OrderDate, Empid, CustID into dbo. Orders from TSQLFundamentals2008.Sales.Orders;The SELECT into statement copies the underlying structure of the source table (including column names, data types, whether null and identity attributes are allowed), and data. Constraints, indexes, and triggers are not copied from the source table.BULK INSERT statementBULK INSERTDbo.
Oracle SQL BASICS (3)-index/trigger/view operations, oraclesql
This document only lists simple operation statements for indexes, triggers, and views.
1. Index
A. Create
Create index idx_name on fdh_client_info (name); -- Common index (Single Column index)
Create unique index uni_idx_id on fdh_client (id); -- unique index
Create index union_idx_name_addr on fdh_client (name, address); -- Union index
B. query
The information that is queried often needs to be saved for use. When querying data with a SELECT statement, you can set the data to be stored in a newly created table or in a variable.
10.6.1 store query results into tables
Use SELECT ... Into statements can store the results of a query in a newly created database or temporary table. If you want to store the query results in a table instead of a temporary table, use the Select ... into a statement should determine that the database that store
tables, and discard the data if it cannot meet the join condition. This method is usually referred to as an internal connection (Innerjoin). In an internal connection, the status of the table participating in the connection is equal. The way that is relative to an internal connection is called an outer join (Outer join). In an external connection, the table participating in the connection has a master-slave matches data columns from the table with each row of data in the primary table, data tha
Au_title (author_au_id, au_lname, au_fname, contract)
VALUES (' 234-34-4611 ', ' John ', ' Smith ', 1)
Insert into Au_title (title_au_id, title_id, Au_ord, Royaltyper)
VALUES (' 234-34-4611 ', ' BU1111 ', 1,50)
There are two issues to be aware of when updating and deleting data through a view:
When the update delete is executed, the data that is deleted and updated must be included in the view result set;
If the view references more than one table, you cannot delete the data with the Dele
cases, because the amount of data in the table is too large, the table is often divided horizontally or vertically in the design of the table, but the change of the structure of the table has a bad effect on the application. If you use a view, you can retain the original structure relationship so that the external mode remains unchanged, and the existing application can still overload the data through the view.
13.9.5 Security
Views can be used as a security mechanism. View users can only vie
Tags: Creating database datetime Mail foreign format query uname null NES--(space): Comment1 Creating a DatabaseQuery newGuthrie KeyThe primary key is consistent with the built-in typeDelete the main table from the table firstPrecautionsFormat: (end + comma end no comma)Self-growth: Automatically add eventsThe difference between a database engine and two differentCase insensitive--CREATE ' DATABASE ' testUse test;DROP TABLE IF EXISTS zones;CREATE TABLE Zones(z_id INT PRIMARY KEY auto_increment,Z
results to ExcelCreation of sequences Common keywordsINSERT INTODeleteUpdateSelect---try not to write *whereInchLike (%, _)ORDER BYGroup by--(Group by enhancement)HavingCase...when ...SetDistinctBetween...and (closed interval, that is, including the preceding number, also including the following number)All Common functionsTo_charTo_dateMoDAvgSumCountDecodeSubstrMaxMinTruncCeilFloorNvlNvl2LowerUpperConcat? Wm_concat There are four types of SQL stateme
Tags: style blog http color os ar for file datacolumn = field, record = entity
Thing log file (used to record database additions and deletions, extension LDF) Database file (but only one is the primary database file (that is, started with it), the remainder is the secondary database file)MDFData type:Shaping (integer)--int, Smallint,bigint,tinyintFloating-point ———— float,realCurrency type (decimal)--moneyboolean data type Bit--true or false,0 or 1Close this table
If you don't add an
Use of the 1.explain plansql> explain plan for delete from T_jingyu; Explained.sql> select * FROM table (dbms_xplan.display); Plan_table_ OUTPUT------------------------------------------------------------------------------------------------------------------- -------------------------Plan Hash value:1368587462------------------------------------------------------------- ----------| Id | Operation | Name | Rows | Cost (%CPU) | Time |--------------------------------------------------------------
SELECT Statement BasicsSELECT From Query all columns: SELECT * from Use the AS keyword to set the alias for the column, and set the Chinese alias to enclose it in double quotation marks (").Use distinct in a SELECT statement to delete duplicate rows.Where: To follow the FROM clause, first use the WHERE clause to query for a record that matches the specified criteria, and then select the column specified by the SELECT statement.A comment is a section of an SQ
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.