![]() As the entries are auto-incremented for each entry, it will be hundred percent unique for each student. The values in that column are automatically created for each individual students that are part of the table. From these columns, s_id column is our artificial column to be used as primary key. Hence we can be hundred percent sure that it will be unique and shown is our "students" table with 5 different students. For example, the first row will have an entry of 1 in the artificial column that we created, and the second row will have 2, and the third will have 3 and so on. Mostly this artificial column will contain numbers that will auto increment itself for each entry(row) added to the table. This artificial key(column) created by us can then be used as a primary key. In order make this selection of primary key's more easier, we can actually create/add an artificial attribute (column) from our side, that will be defined as unique. For example, if a particular student does not provide email address or phone number, we cannot use either of them as our primary key. The selection of the primary key (attribute, or column) to identify one entry/entity (row) uniquely should depend on how confident you are that it will be non-empty, and will be unique for each individual entity(row) in the column. ![]() We can also consider phone number column in the students table to identify one particular student uniquely, or else we can consider email address as well. This attribute (column) is called as primary key in a database. To be able to identify one student uniquely, we need to have an attribute(column), that is guaranteed to be unique for each and every student entry (row) in the database table. Because two different students(rows) could have identical names. However that does not sound like a good solution. We could consider the name attribute (column) to help distinguish one student from the other(ie: Uniquely identify one particular student). When we say students table, the table should have columns like Firstname, Last Name, Phone Number, Email Address etc. Attributes(columns in the table) will help us distinguish one entity from another (one row from the other - A row in the students table will have all the details about a particular student, and a row in the courses table will describe course details). Let’s take the example of students and courses table. Columns will contain different attributes that will describe a row in that table. If you are completely new to databases, then consider a database table as an excel sheet, with different columns and multiple rows. This relationship can then be called as enrollment. There can be a relationship between courses and students. For example, an educational institution might store details about students, courses provided. ![]() The primary responsibility of a database is to store information about different objects or entities, and their relationship with each other. Read: What is relational Database Management Systems If you are completely new to relational database management systems, then I would recommend reading the below article to get an idea about it. ![]() While you are reading this article, you are actually indirectly using MySQL database. MySQL is used by many web applications out there. MySQL is the most widely used open source relational database management system in the world.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |