Database (increase, delete, change, check) database: Three levels: File--Service--Interface (DBMS) two ways of logging on: Windows identity Logon; SQL Server identity login. How do I set up SQL Server authentication? 1. Object Explorer Right-click--Properties--security--SQL Server and Windows identity logon. 2. Object Explorer--security--Login--sa--Right click--Properties--general--Set Password3. Object Explorer--security--Login--sa--Right click--Properties--state--Grant, enable restart of the database service. How do I create a new database? .... ldf--log files. mdf--master data files. ndf--data files in a database, you can have multiple log files, multiple secondary data files, but only one master data file. How do I create a new table? ...... Row order independent, column order independent. SQL statement DDL DML (increment, delete, change, check) DCL add insert into table name (column name, column name, column name,...) VALUES (value, value, value,....) Insert into table name values (value, value, value, value): ) Check One, simple query Select* fromTable nameSelectColumn name, column name, ... fromtable name--projection equivalence and non-equivalence query Select* fromTable namewhereColumn name = value--equivalent query not equivalent querySelect* fromTable namewhereColumn name <>valueSelect* fromTable namewhereColumn name > Value >=Select* fromTable namewhereColumn Name < value <=Multi-Conditional query logic with (and), logical OR (OR)Select* fromTable namewherecondition 1 and Condition 2 ...Select* fromTable namewherecondition 1 or Condition 2 ... If, in the where filter condition, both and and or are present, the and is first calculated. Unless you use parentheses to change the priority level. Range query. Select* fromCarwherePrice >= -and price<= -Select* fromCarwherePrice between -and -Select* fromCarwhereOil=7.4or oil=8.5or oil=9.4Select* fromCarwhereOilinch(7.4,8.5,9.4) fuzzy query. Generally not =, but with like%--Any number of arbitrary characters _--an arbitrary characterSelect* fromCarwhereName like'BMW%'BMW%--Starting with a BMW
%BMW--End with BMW
bmw--As long as it contains the word BMW can be.
__ __ BMW%--Represents the third character starting with a BMW. to re-query: SelectDistinct column name fromcar--If there are duplicate values in the column, only 1 are checked out. Sort Select* fromcar ORDER BY price asc--default is ascending (ascending ascending; descending descending)Select* fromcar Order by price descSelect* fromCar ORDER BY oil asc,price desc--oil main sort, price order Delete Delete fromcar--Delete all data Delete fromCarwherecondition--the condition here is the same as the condition of select. Change The name of the update tableSetColumn name = value, column name = value .....whereCondition Update CarSetPrice = Price + Price *0.15 whereName like'BMW%'Update CarSetName='300C 3.5L Commercial Vehicle', oil='9' whereCode='c012'
Database (Increase, delete, change, check)