The Database Management system
Suppose a student has been absent from school from time to time due to illness and other reasons. Her parents want to know exactly how long the student has been in school for the last three months. To do this he has to go to school, then he has to meet the teachers that his child has. Teachers will then take out the attendance register for the last three months. You will find out from that book how long the student was present in the class, the whole thing is very time-consuming work. But if all the information management in that school If the work is done on a computer through database management software, then it is possible to extract this information in a second. The database that does the work of storing data and the software that manages that database properly is called a database management system.
Computer Memory and Files:
When a computer program works with data in a corner, that data then works in temporary memory. This temporary memory is called RAM. Data is deleted from RAM when the computer is turned off. When you close the program again, the program loses control of the RAM data. So the information that needs to be stored is stored in permanent memory, such as a hard disk. The data we use on the hard disk is stored by a system called file. Let's access it. In such a text file we can write different information and save it. Then I can turn off the computer if I want. When I turn on the computer again, if I want, I can open that file and see the information written before. When people started using computers to store different information, different programs
That is the data that was stored in the file after processing. If you want to change the information in that file or work in another corner with the information, you have to write a new program. For example, an address book, where the names, addresses, phone numbers, etc. of different people will be stored and the information can be found as needed. Then to add new information
(This is called data entry-data entry) the program must be written. You also need to write a program to find the information. Now if someone says that you have to save the email address after the phone number, then you have to change the data entry program and all the other programs. Then let's say, someone said, you have to find out the information by name as well as the email address.
Write new function. Thus the task of data management becomes quite complex and laborious for programmers. Database management software makes that task much easier.
the database is a collection of data, that is, where there is a lot of data. However, in the world of software, a database is a piece of software where a large amount of information can be stored together, useful information can be extracted, new information can be added and any information can be changed, augmented, and deleted as needed. The database management system is made up of some programs or software to manage that database properly. Databases can be divided into metatags. Relational Database and NoSQL. The concept of a relational database is almost 50 years old, but now it is the most used and important database. And the non-SQL database is relatively new and in some cases, its use is increasing day by day especially in various web-based applications. However, due to various limitations, it is not possible to use NSQL in all cases.
The Relational Database
In a relational database, data is stored and published in one or more tables. Some tables can often have a relation. For example, a school's database may contain various types of information about the teachers and students of that school. Again, test results, class routines, all this information can be in the database. All such information will be on a table. For example, teacher table for teacher information, student table for student information, result table for keeping test results. There will be a correlation between the student table and the result table so that the personal information of a student and the information about the test results can be found together from the two tables. And these tables will be combined to create a school database. A database table has two parts, table header, and table body. The table header contains the names of the different columns and the type of data to be stored in those columns. And the body of the table contains the basic information. Each row contains information on a specific subject. What data will be kept in a table and what kind will be in them, has to be decided first.
The student's table may contain the student's name, rail number, class, department/branch, parent's name, parent's phone number, home address, etc. Data types can vary. Just as there are certain data types in the C programming language, there are certain data types in relational databases. Different database builders specify data types at their discretion, but several data types are available in all databases. For example - text, integer, decimal number, date, etc.
The Null Value :
Sometimes Null (or NULL) is used if the value of the corner column in some records in the database table is unknown. For example, there is a column on the student table called Phone Number. Now there is no mention of the phone number that everyone must have, for example, a student named Manik Mia does not have a phone number, so the phone number in his record is blank. The value of the database will be taken as NULL. Again, suppose there is another column in that table called Monthly Family Income. A number of monthly family income. Now, if one does not want to disclose his monthly family income, 0 will not sit there, but it will be empty or NULL. Because in this case 0 means his family has no income anywhere. Again, many times if there is a need to keep the occupations of different people at one table, there is no need to talk about the occupations that everyone must have. For example, if there is information about a three-year-old child on that table, then his occupation will be NULL because he cannot be placed in any profession like student, employee, businessman, or unemployed. Now if the occupation is of text type, then the blank string (i.e. ") should be inserted. No, the cell should be left blank. The blank cell will be considered as database NULL.
The Primary Key :
What is primary is a specific column in a table, with which each record can be identified individually. With which column in the student table can each student be identified separately? Cannot be named, as there may be more than one student with the same name in the same class or in a different class. We can see on the table that the name 'Mizanur Rahman' belongs to a fourth-class student. But there may be a Mizanur Rahman in the sixth class. Again if we say, Mizanur Rahman of the fourth class, then if there is more than one Mizanur Rahman in the fourth class, then he cannot be identified separately. So the name Prima cannot be a key. Rail numbers can't be primary either, because every class has rails 1, 2, 3, and so on. Phone numbers and primary keys cannot be, because not everyone can have a phone number. So the student table that has been created above, there is no primary key in the corner. However, class, branch, and rail numbers - these three columns together can be a primary, because if these three information together we can separate each student. When a primary key is created by combining multiple columns, it is called a composite key.
When creating a table in the database, it is necessary to specify which column can be the primary. Again, it may not be possible to identify the primary key at any time. Then a column is added at the beginning. It will be a number column and will be separate for each record or ray. Typically, a column called id is added to the table, which contains integer type data and is accompanied by an Auto Increment feature, so that the value of each insert increases one by one (insert this column). So you don't have to pay for it yourself, the database system controls it itself).
The primary key should be on the table :
the relational database. Although tables can be made in addition to the primary key. In that case, many times the database itself creates a primary key. Class, Branch, and Rail: These three columns combine to create the primary key on the student table. But here. That could be a problem. By creating the table in this way, we can only keep the information of the current students. It will not be possible to keep track of past students, such as a student from five years ago, who was studying in the seventh-grade daytime branch and whose rail number was two, which cannot be excluded separately. So we can give a separate ID for each student in a new column. In some places, the railway number is created in such a way that by looking at the railway number, it is possible to know the number of students in any branch of any class of any year. In many institutions, it is also called the registration number, which is always the same for a student. The roll number will change if you go upstairs, but the registration number will not change.
SQL Relational Database :
A programming language called SQL (SQL: Structured Query Language) is used to write, read, modify, and other information in the database. Although SQL has language rules, many commercial databases use their own query language, which is very close to standard SQL.
What is the main difference between SQL and common programming languages? When a programmer writes a program to solve a specific problem, the May algorithm for solving that problem actually expresses it through the programming language. These programs specifically tell the computer how and at what stage the work will be done. The computer just follows those instructions. And when writing SQL queries, you have to say what information is being requested from the database system, or what information should be kept. That is, you have to tell what to do. And how that work is done depends on the database system. For this reason, SQL is called a declarative programming language. According to C and C, other programming languages are called procedural programming languages. The SQL language has been created in such a way that not only programmers but also people outside the world of programming, can easily learn and use it. SQL can be further divided into several parts. Two of the most important are: Data Definition Language (DDL for short) and Data Manipulation Language (DML for short).
Sorting means sorting in a certain order. This sequence can be a sequence of numbers, a sequence of names, or something else. For example, when we make a list of students, we can sort them by name order, class order or rail number order. There are different types of algorithms in computer science for setting. Some are simple, some are complex. Some are fast, some are slow, but when using sorting in a database, you don't have to worry about how the database software will do the sorting, but what you need to sort by, and in what order (from big to big, from big to small). At the end of the select query, type ORDER BY, then type the name of the column, then the data will come in six-to-large order according to the data in that column.
SQL is a declarative programming language, as mentioned earlier. What matters is what you do here. How to do it is the responsibility of the database software. Now, when there is a lot of data in a corner table (for example, five lakhs, ten lakhs, or more), the speed of different queries decreases a lot, which means the queries take much longer to run. If such a table contains the data of all the students of Dhaka Baird in this year's secondary examination, then that table will contain records or opinions of five to one million votes. Now if an attempt is made to find out the information of a student by name or rail number (or registration number) from there, then that query will take a long time to run. Because. Then everyone's information will be checked one by one through linear search and with whom to find matches. Yes, their information will be shown. The previous chapter discusses how linear search works. Done. The more records there are on the table, the longer it will take. Indexing is a special method by which data can be found easily and quickly. For example, when using a dictionary, it doesn't take much time to look up a word. Because the words are arranged in a sequence, and when you open a page of the dictionary, the desired word is easily found on that page, before or after it. If the data is sorted then it can be found using a binary search. Similarly, if you create an index on a particular column in a corner, looking for data with the value of that column, the database software can extract it very quickly. The user does not have to know how the database will do the job of creating the index, he just has to tell on which column to create the index. Indexes can be created on multiple columns if required.
Like More To Read