drichards188 / riskProcessor

get and process symbols for risk calcs
1 stars 0 forks source link

Convert mysql columns to lowercase #8

Open drichards188 opened 9 months ago

drichards188 commented 9 months ago

Use lowercase letters: It's common practice to use lowercase letters for column names, table names, and other database objects. This makes your database schema more readable and consistent.

Use underscores for spaces: When you have multi-word column names, it's a good practice to separate the words with underscores (e.g., first_name, order_date) rather than spaces or other special characters.

Be descriptive: Choose column names that are descriptive and indicate the purpose of the column. Avoid cryptic or overly abbreviated names. For example, use product_name instead of prod_nm.

Use singular nouns: Column names should typically use singular nouns (e.g., user instead of users). This is in line with the convention that a row in a table represents a single entity.

Avoid reserved words: Do not use MySQL reserved words as column or table names to prevent conflicts and errors. You can find a list of reserved words in the MySQL documentation.

Be consistent: Maintain consistent naming conventions across your entire database schema. This includes tables, columns, indexes, and other database objects.

Use meaningful prefixes: Consider using prefixes to indicate the table to which a column belongs, especially when you join multiple tables in queries. For example, order_date in the orders table and customer_name in the customers table.

Use primary keys: Name primary key columns using a standard convention, such as id, followed by the table name (e.g., user_id, product_id). This makes it clear which column serves as the primary key.

Foreign key references: When creating foreign key columns, it's helpful to include the referenced table's name in the column name (e.g., order_customer_id for a foreign key referencing the customers table).

Avoid special characters: Stick to alphanumeric characters (letters and numbers) and underscores in column names. Avoid spaces, hyphens, or other special characters.

Keep it concise: While descriptive names are important, avoid overly long column names. Aim for a balance between descriptiveness and brevity.

Use consistent casing for multi-word names: If you choose to use mixed-case or camelCase for multi-word column names (e.g., firstName, orderDate), ensure that you consistently apply the casing style throughout your schema.