Computer Science – 9.2 Algorithms | e-Consult
9.2 Algorithms (1 questions)
Login to see all questions.
Click on a question to view the answer
Choosing Identifier Names for Student Database Fields: The principles for choosing good identifier names are the same as described above. Clear, descriptive names are essential for database design. Using consistent naming conventions is also important for database management and querying.
- Avoid Abbreviations: While abbreviations can save space, they often make the code harder to understand. For example, using
stud_idis less clear thanstudentID. - Use Camel Case or Snake Case: Camel case (e.g.,
studentID) or snake case (e.g.,student_id) are common conventions for database field names. Consistency is key. - Avoid Reserved Words: Be careful not to use database reserved words as field names (e.g.,
order,group).
Examples of Good and Bad Identifier Names:
Bad: id, num, info | Good: studentID, firstName, lastName, courseOfStudy, emailAddress, phoneNumber |
Bad: sid, cname | Good: studentID, courseName |
The good examples are self-explanatory and clearly indicate the data they represent. This makes the database schema easier to understand and maintain.
Identifier Table:
| Attribute Name | Identifier Name |
| Student ID | studentID |
| First Name | firstName |
| Last Name | lastName |
| Course of Study | courseOfStudy |
| Email Address | emailAddress |
| Phone Number | phoneNumber |