/* (start of program header comment) * Copyright and Version Statement of program (c) 2011, student of Computer College of Yantai University * All rights reserved. * File Name: * Author: Shangpeng * Date of Completion: September 15, 2012 * Version
I've been working on a BBS project recently and I'm having a problem with the list of topics.
The Bbs_topic data table structure is defined roughly as follows:
TABLE Bbs_topic
(
TopicID INT not NULL IDENTITY (1, 1) PRIMARY KEY,
Title NVARCHAR
First, if syntaxif then -- SQL statements; Else -- SQL statements; End if;Second, if usedelimiter $$--Create statementCreate TriggerMy_tri afterInsert onOrders forEach rowbegin --get inventory of items in table Inv to variable @inv
1, test: the detection of the expression is established, the return value is 0, otherwise, not 0Method:1) test expression2) "Expression"2. File test:-D: Whether it is a directory-F: Whether it is a file-E: whether there is-r: Whether Read permission
If statement1. What is a conditional test operation?To make a shell script "intelligent", the problem is to differentiate between different situations to determine what action to take. The shell environment, based on the return status value ($?)
Recently in learning LinuxHere is a small step of your own writingFootstep content to compare three numbers to get the largest numberFootstep statements are as follows:#!/bin/bashRead-p "Input A:" ARead-p "Input B:" bRead-p "Input C:" CIf [$a-ge $b]&
PythonIf statement>>> x = 1>>> y = 2>>> if x > y:... print (' x is bigger! ').. else:... print (' Y is bigger ')...Y is bigger>>> x = 1>>> y = 1>>> if x > y:... print (' x is bigger! ')... elif x ==y:... print (' x equal y ').. else:... print (' Y
Shell tip:1. Need to add ' $ ' when referencing variables2.shell variable viewing and deletionSet | grep variable name//view Set Variable unset variable name//delete variableThe difference between single and double quotes in 3.shell650) this.width=65
Python all data types are objectsprint(type(123))print(type(4545.666))print(type(1323.))print(type(‘adbn‘))All data types are objectsprint(type([1,2,2,3,4,5,56,‘a‘,‘b‘]))print(type((1,‘xddfsdfd‘)))print(type(set([‘s‘,‘rff‘,‘dd‘])))print(type({‘a‘: 1,
Points to note:1. Stitching only for strings;2. equals = =;3. Define first, then assign value, var a=10;If you define a decimal or integer variable, the value after the equal sign is written directly. 4. All characters are in English half-width5.>=
Numeric operationsInteger operation "Three kinds, one can be mastered"Expr numeric operator number[[email protected] ~]# Expr 1 + 1 (OP symbols are all +-*/NOTE: * Requires \*.) % is the remainder, only 0 1 2)2[[email protected] ~]# Expr 45 \*
The use of conditional expressions in shell programming
If conditionThenCommandElseCommandFi, don't forget this ending.
If statement forgets the end fiTest.sh:line 14:syntax error:unexpected End of fi
Three
--if/else StatementsifConditions ThenSQL statementsElseSQL statementsElseIfSQL statementsEnd if;Create procedureTest1 ( Number int) begin if Number > Ten Then Select User(); Else Select 'Please input a number >'; End if; End$Mysql> Create
01. Judging by File type = Common-D,-E,-FTwo types of formats:TEST-E/root/install.log = Common[-e/root/install.log] = both spaces must haveExample: [-d/root] && echo "Yes" | | echo "No": Determine if the file exists and whether it is a directory
If statements skip this statement and execute the next statement. how to write a lot of data into the database?
For example, if ($ a = 2 ){
Skip this entry
}
How should I write the code? the full code is directly provided by the eldest brother.
conditional Statements
When you write code, you often need to perform different actions for different judgments.
You can use conditional statements in your code to accomplish this task.
If...else statements
Executes a piece of code when the
Exercise : Write a script: You can accept a parameter that uses the following form:script.sh {Start|stop|restart|status}If the argument is start, the empty file/var/lock/subsys/script is created and the starting script successfully is displayed. ;If
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.