Chapter 1: WEB Program Development History Chapter 2: Working Principles of WEB Program: Mainstream web program describes ASP technology (Microsoft's Based COM component based on VBScript, JScript as scripting language server-side program) ASP (Active Server Pages) Is a development environment of the web server, one of ActiveX technology. Using it produces running dynamically, interactive, high-performance service applications. Advantages: Simple learning, easy writing. Disadvantages: The implementation efficiency is general, and the safety is not high. PHP Technology (Fully Open Source) Advantages: Operation in WIN and UNIX, Linux platform, completely free, perform efficiency, high-sized website system. Disadvantages: Technical support is poor, configuration environment is difficult, code is not standardized, and it is relatively difficult to learn. JSP technology (Sun Development Java-based server-side program) Advantages: Under WIN and UNIX, Linux platform, technical support strong, high security, high execution efficiency, cross-platform, suitable for super large website systems and database systems . Disadvantages: Difficulties, information less CGI (Common Gateway Interface Community) Advantages: Can be run under WIN and UNIX, Linux platform, support a variety of low-level languages such as C / C , the highest security, cross-platform is good. Disadvantages: Difficult to write, the execution efficiency is the lowest. Chapter 4: VB Script Script Getting Started with VBScript statement is a VB-based scripting language, mainly used for web server-side program development, us only introduce some simple statements, mainly to operate several common statements for the database . A Define Variables DIM Statement DIM A, B A = 10 B = "OK!" Note: The defined variable can be a numeric value, or other types of characters or other types.
B Simple Control Process Statement 1. IF Condition 1 THEN State 1ELSEIF Condition 2 THEN SOST 2ELSE Statement 3.1While Condition Statement Wend 3.for Count = 1 To N Step M State 1 EXIT for Statement 2Next
Chapter 5: Structured Database Getting Started Explains SQL: Structured Quevy Language (Structured Query Language) Abbreviation. DATA: Data Base Manage System Abbreviation
Common Simple Structured Database: ACCESS Common DBMS: MS SQL Server, Mysql DBMS Differences with Ordinary Structured Database: DBMS is more secure and efficient, DBMS does not allow direct access to database files, and must access the relevant database through its management system. Support for concurrent access. SQL Reference Manual SQL is an abbreviation for Structured Quevy Language (Structured Query Language). SQL is an operation command set that is designed for the database, which is a fully fully equipped database language. When using it, you only need to issue a "do" command, "how to do" is not considering the user. SQL is powerful, easy to learn, easy to use, has become the foundation of database operation, and now almost all databases support SQL. ## 1 Second, SQL Database Data Architecture SQL Database The data architecture is basically a three-level structure, but the terminology is different from traditional relationship model. In SQL, relational mode (mode) is called "Basic Table"; storage mode (internal mode) is called "Stored File); Sub-mode (outside mode) is called" view "(View" ); The tuning is called "row"; the attribute is called "column". Name symmetrical, such as ^ 00100009A ^: ## 1 Third, the composition of the SQL language first allows us to make us a basic understanding of the SQL language, introduce the composition of the SQL language: 1. A SQL database is a table (Table The collection, which is defined by one or more SQL mode. 2. A SQL table consists of a line set, a line is a sequence (collection), each column corresponding to a data item. 3. A table or a basic table or a view. The basic table is a table that is actually stored in the database, and the view is the definition of a table consisting of several basic tables or other views. 4. A basic table can span one or more store files, one or more basic tables can also be stored. Each storage file corresponds to the external storage of the previous physical file. 5. Users can use the SQL statement to query the views and basic tables. In the user's point of view, the view and the basic table are the same, no difference, all the relationships (tables). 6. SQL users can be an application or a terminal user. SQL statements can be used in a program in a host language, and the host language has Fortran, Cobol, Pascal, PL / I, C, and ADA languages. SQL users can also be used as a stand-alone user interface for terminal users in interice. ## 1V, operate SQL for the database includes all the operations of the database, mainly consisting of 4 parts: 1. Data definition: This part is also called "SQL DDL", defines the logical structure of the database, including defining databases , Basic table, view, and index 4. 2. Data manipulation: This part is also known as "SQL DML", including two major class operations of data query and data update, where data updates include insert, delete, and update three operations. 3. Data Control: The control of the user access data has the authorization, integrity rules of the view, the transactional statement, and the like. 4. Use of embedded SQL languages: Specify the rules used in the host language program. Below we will introduce: ## 2 (1) Data Definition SQL Data Definition Function Includes Defining Database, Basic Table, Index, and View.
First, let's take a look at the basic data type provided by SQL: (, if ^ 00100009B ^) 1. Create a database for the establishment of the database: Database is a data set including multiple basic tables, its statement format : CREATE DATABASE
(1) Definition of the basic table: Basic Table is a non-exported relationship, and its definition involves the table name, column name, and data type, etc., its statement format is: Create Table [ Example: To create a student situation table (STRETE) CREATE TABLE Student // Create Basic Table Student (ST_CLASS CHAR (8), // Definition column ST_CLASS class, data type is 8-bit set string ST_NO Char (10) Not Null , // Defining the column ST_NO students, type 10-bit set string, non-empty ST_NAME CHAR (8) Not null, // Defines the column ST_NAME name, type 8-bit set string, non-empty ST_SEX CHAR (2 ), // definition column ST_SEX gender, type 2-bit set string ST_AGE Smallint, / / definition column ST_AGE age, type is short-integrated primary key (ST_NO)) // Define ST_NO Learning number is the primary key. Example: To create a course setting table (SUBJECT) CREATE TABLE SUBJECT / / Create Basic Table Subject (SU_NO CHAR (4) Not null, // Defines the column SU_NO Class, type 4-bit set string, non-empty su_subject char ( 20) NOT NULL, / / Definition column Su_SUBJECT course name, type 20-bit set string, non-empty su_credit integer, // definition column Su_credit credits, type is long integer su_period integer, // When defining column SU_PERIOD, the type is Long integer Su_PRENO CHAR (4), // Defines the column SU_PRENO Prescription, type 4-bit set string primary key (su_no)) // Defines the SU_NO class as the primary key. Example: To create a student selection table (SCORE) Create Table Score // Create Basic Table Score (ST_NO CHAR (10), // Definition Column ST_NO Learner, Type 10 Position Strings SU_NO CHAR (4), // Define the column SU_NO class, type 4-bit set string sc_score integer null, // definition column sc_score, type is long, which can be an empty value forign key (ST_NO) Reference Student, // Introduced from Table Student Key ST_NO to ensure that the association of the table Student and the synchronous Foreign Key (Suno) Reference Subject // introduces reference foreign key SU_NO from the table Subject to ensure the association and synchronization of the table Subject (2) Basic table Delete: To remove a basic table from the database and its full content, its statement format is: DROP TABLE [ Increase the statement format of the attribute: ALTER TABLE [ (1) Definition of the view: Defining a view can be implemented using the CREATE VIEW statement, its statement format is: CREATE VIEW view name AS SELECT statement exported from a basic table: Example: Example: Example from the basic table Student export only female student situation View Create View WomanView AS // Create a view Womanview Select St_Class, ST_NO, ST_NAME, ST_AGE // Select Column ST_CLASS, ST_NO, ST_NAME, ST_AGE Display from Student // Introduction from Basic Table Student WHERE ST_SEX = 'Female' // Introduction Condition For gender "female", pay attention to the character variables to export views from multiple basic tables using single quotes: for example: exporting only female students and scores from the Basic Table Student and Score View CreateView Woman_Score AS / / Defined View Womanscore Select Student.st_class, student.st_no, student.st_name, student.st_age, score.sc_score // Selective Display Related column from student.score // introduced from Basic Table Student and Score to WHERE Student.st_sex = 'Female' and score.sc_score> = 60 and student.st_no = score.st_no // Select Conditions: Sex is "female" and scores more than 60 points. And use ST_NO to link two tables. If the application of this view will, simply use statement select * from Woman_score // "*" for wildcard, delete all elements (2) view: Used to delete no longer used views, its statement format As follows: DROP View View Name: Delete the Woman_score view established above Drop View Woman_score 4. The index defines and delete indexes belong to physical storage concepts, not logical concepts. Abandon the index concept in SQL, use the primary key concept directly. It is worth mentioning that some relationships of DBMS include indexing mechanisms and primary key mechanisms, here we recommend using primary key mechanisms because it takes a lower in system resource and high efficiency. (1) The definition of the index: index is based on the basic table, its statement format is: create [unique] index index name on [ Example: Establish indexes in the basic table student, respectively, as ascending and descending, and index values do not allow the Create Unique Index Stindex ON // Creating Index Stindex Student (ST_NO ASC, ST_AGE DESC) / / to Student ST_NO and ST_AGE Establish Index (2) Deletion: DROP INDEX Index Nurse: Delete Strip INDEX STINDEX ## 2 (2) Data Query SQL is a query function, as long as it is data stock Data, can always find it from the database through the appropriate method. The query statement in SQL has only one: SELECT, which can work with other statements to complete all query functions. The full syntax of the SELECT statement can have 6 clauses. The complete syntax is as follows: SELECT target table list or column express collection from Basic table or (and) view collection [WHERE condition expression] [Group By column name collection] [Order By Column Name] [Collection] ...] The semantics of the entire statement are as follows: From the table listed in the FROM clause, select the tuple that meets the conditional expression given in the WHERE clause, and then prescribed in the GroupBy clause (packet subsis) The value packet of the column, then extract those groups that meet the Conditional expressions in the Having clause, press the column name or column expression value to the select clause. The ORDER clause (sort clause) is reordering the target table of the output and can be attached to the ASC (ascending) or DESC (descending) arrangement. The following operators and computational functions can occur in the conditional expression f in the WHERE clause: arithmetic comparison operators: <, <=,>,> =, =, <>. Logical operators: and, or, not. Collection operator: Union (and), INTERSECT, ExcePt. Collection member qualification operators: in, NOT IN predicates: exists (existing quantifiers), all, some, unique. Polymer function: AVG (average), min (minimum), max (max), sum (and), count. F, the operation object can also be another SELECT statement, that is, the SELECT statement can be nested. The above just lists several main operations in the WHERE clause, because the conditions in the WHERE clause can be complicated, so the semantic semantic expression can be more complicated than its mathematical prototype. Below, we have used three basic tables as described as examples, demonstrate the application of SELECT: 1. Unconditional Query: Find out the course of all students Select St_no, Su_NO from Score Example: Find all students SELECT SELECT * From student "*" is a wildcard, indicating the value of all attributes indicated by the relationship indicating from the FROM. 2. Conditional query condition query is a query with a WHERE clause, and the object to be queried must meet the conditions given by WHERE clause. Example: Find a student of any less less than 70, class, class, SELECT UNIQUE Student.st_class, student.st_no, student.st_name, student.st_sex, student.st_age, score.su_no, score.score from Student, score where score.score> = 70 and score.stno = student.st_no This uses unique is not from the query result set to repeat line, if you use Distin, you will remove your row. The priority order of the other logical operator is NOT → AND → OR. Example: Students who find the course number C02, the test score does not match the class, the test score is not asked. Single Su_no = 'c02'and score <60 3. Sort query sorting query refers to ascending the query results as defined by specified properties (ASC ) Or descending (DESC) is arranged by the Order By clause. Example: Find a child, and put the results from the big to small alignment Select Unique Su_no from score where score <60 ORDER BY SU_NO DESC 4. Nested Query Nested query refers to the WHERE clause contains Select Subs This sentence is used in more complicated situations that span multiple basic tables. Example: Finding the course number C03 and the student number of the course is 80 points, name SELECT ST_NO, ST_NAME FROM Student Where STNO INO INO = 'c03' and score> 80) Here need YES: When the query involves multiple basic tables, the nesting query is subjected to the layout, which has the structural programming characteristics. In nested queries, IN is commonly used. If the user can exactly know that the inner query returns a single value, it can also be used to represent the user's requirements. 5. Calculation query calculation query refers to the results of certain functions that can only be calculated through direct use of specific functions (aggregate functions) provided by the system. Commonly used functions include count count (column name) calculating a number of sum (column name) in a column (column name) to sum (this column value is numerical) AVG (this column value is numerical) AVG Column name) Ask average value (this column value is a numeric model) max (column name) Seeking a maximum of the maximum min (column name) in a column value in a column value: seeking male student Total number and average age Select count (*), avg (ST_AGE) from home: Samples of students in the course: Number of students in the course Select Count (DistINCT ST_NO) from score: This must be added to Distinct, because Some students may elect a multi-do-course, but only one person is counted, so it is necessary to filter with Distinct. ## 2 (3) Data Update Data Updates include data insertion, deletion, and modify operations. They are completed by the INSERT statement, the delete statement, and the UPDATE statement. These operations can be performed on any of the basic tables, but there is a limit on the view. Where the view is exported by a single basic table, the insertion and modification operation can be performed, but the delete operation cannot be performed; the above three operations cannot be performed when the view is exported from a plurality of basic tables. 1. There are two ways to insert the data insertion of the data into SQL: one is the insertion of the cell group, the other is insertion of the multi-group. Insertion of unit group: Insert a grade tuple (100002, C02, 95) to the Basic Table Score, using the following statement: Insert Into Score (ST_NO, SU_NO, SCORE) VALUES ('100002', 'C02', 95) Thereby, the insert statement format of the cell group can be given: INSERT INTO table name (column name 1 [, column 2] ...) VALUES (column value 1 [, column value 2] ...) where the column name is to insert The value of the column name collection, the column value sequence is the corresponding value to be inserted. If inserted a full column value of a table, the column name can omit the unwritten, such as the above (ST_NO, SU_NO, SCORE) can be omitted; if inserted into a table value, the corresponding column name must be listed. At this time, the column names not listed in this relationship take a null value. Insertion of multiple groups: This is a method of inserting the SELECT statement query results into a known basic table. For example: The average score of each student is required in Table Score and remains in a table. At this point, you can first create a new basic table Stu_AVGRADE, and then use the INSERT statement to put the average score of each student in Table Score (available to SELECT). CREATE TABLE STU_AVGRADE (ST_NO CHAR (10) NOT NULL, / / Defining column ST_NO students, type 10-bit set string, non-empty AGE_GRADE SMALLINT NOT NULL) // Defining column AGE_GRADE average, type is short, non- Empty INSERT INTO STU_AVGRADE (ST_NO, AGE_GRADE) SELECT ST_NO, AVG (Score) from score group by st_no // must be calculated by a student grouse because the average scores of all courses of each student are required. 2. Data Delete SQL Delete Action refers to the record that meets WHERE Chapter 6: ASP Getting Started Explains the A. ASP Identifier <% ASP Statement%> B. ASP Built-in Objects Explains the Response object: The server side sends the information object to the client, including direct sending information to the browser, reordbing the URL, or Set the cookie value. REQUEST object: The request proposed to the server. Session object: As a global variable, the entire site takes effect throughout the site. Server object: Provide access to the method and attributes on the server. ( a) General usage of response objects, such as: <% Resposne.Write ("Hello, Welcome To ASP!")%> Will Hello, Welcome to ASP! This paragraph <% response.redirect is available in the client browser ("www.sohu.com")%> If this paragraph is executed, the browser will automatically connect to the URL of "Sohu" about the usage of the Response object, you can study the general use of the REQUEST object, such as customers. The request to be submitted to the server is the column passed through the Request object. For example, the personal information you filled in the mailbox is to pass the information to the server through this object, such as: This is a form of a form, This is to fill in the information to the customer. After filling, pressing "Submit" to the request.asp file processing, then deposit into server database (
(Column Name [, Column Name]. .....) [, Check (Condition)] [Other Parameters]) Where,
(Column [, Column Name] ...)] is used to specify foreign keys Referring to the integrity constraint, the Foreign Key specifies the relevant list as the foreign key, which refers to the specified column of another table, which is the column in the outer table introduced by Reference, and the system will default a column name when not specified That is the same as the column name of the reference key, it is to note that the reference must be used when using the foreign key, and the foreign key reference integrity constraint condition specifies: the value of the foreign key is the same as the corresponding primary key, or null value (empty value) Specifically different from the implementation system) [, CHECK] is used to check the data in the deposited table using the specified condition to determine its Legitimacy and improve data security.
(Column [, Column Name] ...)] [, Check (Condition)] [Other Parameters]) For example: in the Basic Table Student Join the list of STBORNs, the data type is DATE, and the statement format that cannot be deleted with an empty value ALTER TABLE Student Add (STBORN DATE NOT NULL) is: ALTER TABLE [