Database Systems Flashcards
Data functions
Output the current date or time and are used either to filter records or to write date and time information
- CURRENT_DATE
- CURRENT_TIMESTAMP
String functions
CONCAT(..,..) - combines the values passed as parameters to a character string
CONCAT_WS(separator,…,…) - combines the values passed as parameters to a character string. Always insert the characters passed as the first parameter as a separator between 2 values
ORDER BY + sequence indicators
ORDER BY is used to sort the result set of a query
DESC=descending
ASC=ascending
-(NS) = default value = ascending
Keywords for calculations
COUNT SUM AVG MAX MIN
Column comparitive operator
ANY
ALL
EXISTS
Types of N:M Relationships
N:M
N:CM
CN:CM
Types of 1:1 relationships
1:1
1:C
C:C
Types of 1:N relationships
1:N
1:CN
C:CN
C:N
SQL command to create a table
CREATE TABLE name( column defintion primary key definition [integrity rules, background] [foreign key definition] [specifying conditions for columns] )
Column defintion
General schema for defining columns can be specified as follows:
name data type [NOT NULL] [DEFAULT default value] [UNIQUE] [CHECK (condition)]