Qbe:query by Example
? Query Language based on the screen table
? Query Request: Construct a query as a form
? use sample elements (domain variables) to represent possible scenarios for query results
? Query results: Display in tabular format
QBE operating Framework
Constructing several elements of a query
Example element: Field variable, must be underlined
The sample element is a possible value in this field, which does not have to be an element in the query result
Print operator P.: Specifies the attribute columns that are included in the query result
Query criteria: Do not underline
You can use comparison operators >,≥,<,≤,= and ≠ where = can be omitted
Sorting requirements
Conditional query
common set functions:
function name |
function |
cnt |
tuple count |
sum |
sum |
avg |
averaging |
max |
max |
min |
minimum |
inquiry information is the average age of students.
sort the results of a query
Sort Ascending:
To sort the results of a query in ascending order of a property value, simply fill in the corresponding column. AO.?
Sort Descending:
Sort by descending? Do.
Sort multiple columns:
If you sort by multiple columns, use the? AO (i).? Or? Do (i).? Indicates that I is the priority of the sort, the lower the I value, the higher the priority level
Check the names of all the boys, the query results are ordered in ascending order of the department , and the students of the same department are sorted by age.
Modify Operation
two lines representing the pre-and post-change sample elements
Must be operator? U.? Put it on the relationship.
Eg: The age of all students in the computer system is changed to 18 years old
Eg: increase the age of 95001 students by 1 years
Eg: increase the age of all students in the computer system by 1 years
Insert Operation
Eg: the information is 95701 girls, name Zhang San, age 17 years old into the database.
Delete operation
Eg: Delete student 95089
To ensure referential integrity, delete all courses selected by 95089 Students before deleting 95089 students
relational database domain relational calculus language QBE