Data Flashcards
1
Q
SELECT statement example
A
- SELECT [columms]
- FROM [tables]
- WHERE [search_condition]
- ORDER BY [order_expresssion ASC | DESC]
2
Q
WHERE with text values
A
- Requires apostrophes around the value
- Example:
- ‘XX’
3
Q
WHERE additional operators
A
- AND
- <
- >
- LIKE
4
Q
- All strings that start with X
- All strings that end with X
- All strings that contain with X
- All strings that start with X, Y or Z
A
- LIKE ‘X%’
- LIKE ‘%X’
- LIKE ‘%X%’
- LIKE ‘[XYZ]’
5
Q
SQL aggregate functions
A
- AVG - Returns the average value
- COUNT - Returns the number of rows
- FIRST - Returns the first value
- LAST - Returns the last value
- MAX - Returns the largest value
- MIN - Returns the smallest value
- SUM - Returns the sum
6
Q
SQL scalar functions
A
- UCASE - Converts a field to upper case
- LCASE - Converts a field to lower case
- MID - Extract characters from a text field
- LEN - Returns the length of a text field
- ROUND - Rounds a numeric field to the number of decimals specified
- NOW - Returns the current system date and time
- FORMAT - Formats how a field is to be displayed
7
Q
UPDATE statement example
A
- UPDATE [table]
- SET [update_expression]
- WHERE [search_condition]
8
Q
INSERT statement example
A
- INSERT INTO [table] ([colum_list])
- VALUES ([value_list])
9
Q
DELETE statement example
A
- DELETE FROM [table]
- WHERE [search_condition]
10
Q
ADO.NET Namespaces for SQL Server Data Access
A
- System.Data.SqlClient
- System.Data.SqlTypes
- System.Data
11
Q
How to insert a backslash
(C# assumes that every backslash is the start fo a special character)
A
- Use two backslash: \
- Put the @ character before the entire string: @”string”