<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abhishek Gaur on Medium]]></title>
        <description><![CDATA[Stories by Abhishek Gaur on Medium]]></description>
        <link>https://medium.com/@abhishek_gaur?source=rss-cba18bd9d1ee------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-JvYf4mJi8C0WHCmCr8cZg.jpeg</url>
            <title>Stories by Abhishek Gaur on Medium</title>
            <link>https://medium.com/@abhishek_gaur?source=rss-cba18bd9d1ee------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:48:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhishek_gaur/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Have you heard about “Pickling” in Python?]]></title>
            <link>https://medium.com/@abhishek_gaur/have-you-heard-about-pickling-in-python-9005d6758127?source=rss-cba18bd9d1ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/9005d6758127</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[pickling]]></category>
            <dc:creator><![CDATA[Abhishek Gaur]]></dc:creator>
            <pubDate>Mon, 10 Apr 2023 02:08:55 GMT</pubDate>
            <atom:updated>2023-04-10T02:08:55.220Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*UeYRIvHXpv9LYxaPmIXh0Q.png" /><figcaption>Fig.1: Pickling in Python</figcaption></figure><p>Python is a versatile and powerful programming language that is widely used in various industries, including machine learning, web development, and data science. One of the unique features of Python is its ability to serialize objects and save them as binary files, known as pickling. In this article, we will explore what pickling is, its advantages, and how to implement it in Python with an example.</p><h3>What is Pickling in Python?</h3><p>Pickling is the process of converting a Python object into a binary format that can be stored or transmitted. The term “pickling” is used because the process is similar to preserving vegetables in a jar, where the vegetables are stored in a sealed jar to keep them fresh for a long time. Similarly, pickling in Python allows you to store the object in a compressed format and retrieve it later when needed.</p><h3>Advantages of Pickling</h3><p>There are several advantages of pickling in Python, including:</p><ol><li>Data Persistence: Pickling allows you to store objects in a binary format, which can be easily retrieved later when needed. This makes it useful for storing data persistently, such as when working with large datasets.</li><li>Platform-Independent: Pickling is platform-independent, which means that you can use the same binary file on different platforms, including Windows, Linux, and macOS.</li><li>Efficient Storage: Pickling allows you to store objects in a compressed format, which means that the file size is smaller compared to storing data in a plain text format.</li></ol><h3>How to Pickle an Object in Python?</h3><p>To pickle an object in Python, you need to use the pickle module, which is included in the standard library. The pickle module provides two methods for pickling an object:</p><ol><li>dump: This method takes two arguments - the object you want to pickle and the file object to which you want to save the object.</li><li>dumps: This method is similar to “dump”, but instead of saving the object to a file, it returns a string representation of the pickled object.</li></ol><p>Here’s an example of how to pickle an object in Python:</p><p>import pickle</p><pre>import pickle<br><br># Define an object to pickle<br>data = {<br>    &#39;name&#39;: &#39;John Doe&#39;,<br>    &#39;age&#39;: 30,<br>    &#39;location&#39;: &#39;New York&#39;<br>}<br><br># Pickle the object<br>with open(&#39;data.pickle&#39;, &#39;wb&#39;) as f:<br>    pickle.dump(data, f)</pre><p>In the example above, we first import the pickle module. Next, we define an object called data that contains some data. We then use the open function to create a file object and use the dump method of the pickle module to pickle the object and save it to the file.</p><h3>How to Unpickle an Object in Python?</h3><p>To unpickle an object in Python, you need to use the pickle module. The pickle module provides two methods for unpickling an object:</p><ol><li>load: This method takes one argument - the file object from which you want to load the pickled object.</li><li>loads: This method is similar to “load”but instead of loading the pickled object from a file, it loads it from a string representation of the pickled object.</li></ol><p>Here’s an example of how to unpickle an object in Python:</p><pre>import pickle<br><br># Unpickle the object<br>with open(&#39;data.pickle&#39;, &#39;rb&#39;) as f:<br>    data = pickle.load(f)<br><br># Print the unpickled object<br>print(data)</pre><p>In the example above, we use the open function to create a file object and use the load method of the pickle module to unpickle the object from the file. We then print the data.</p><p><strong>Conclusion:</strong></p><p>Pickling is a very useful feature of Python that allows you to <strong>serialize and deserialize </strong>Python objects, making them easily transportable and storable. It is particularly useful when working with complex data structures that are difficult to represent in a simple file format. By using the pickle module, you can easily store and retrieve data in a binary format, making it easy to transport between different systems, applications, and languages. However, it is important to keep in mind that pickling can have security risks if used improperly, so it is important to use caution when unpickling data from an untrusted source. Overall, pickling is a powerful tool that can greatly simplify many common programming tasks, and it is a skill that any Python programmer should be familiar with.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9005d6758127" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Relational Schema and Data Repository creation For Bank Management System]]></title>
            <link>https://medium.com/@abhishek_gaur/relational-schema-and-data-repository-creation-for-bank-management-system-3bd07068bf1b?source=rss-cba18bd9d1ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bd07068bf1b</guid>
            <dc:creator><![CDATA[Abhishek Gaur]]></dc:creator>
            <pubDate>Mon, 20 Feb 2023 18:07:20 GMT</pubDate>
            <atom:updated>2023-02-20T18:07:20.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*HC6qyF13AAYhfmHEjErEOA.png" /></figure><blockquote><strong><em>Overview</em></strong></blockquote><p>A schema is a structured framework, outline, or plan that is created prior to the implementation of a database system. This framework represents the interconnections and properties of real-world entities that will be implemented in the database.</p><p>The purpose of constructing a schema in databases is to visualize the organization of data before the actual implementation of the database. By doing so, we can better understand how the entities in the real world are linked to each other and their properties.</p><blockquote><strong><em>Scope of the Project</em></strong></blockquote><p>This article details the development of a <strong>Database System</strong> that caters to banking services. The system comprises several entities and their interrelationships that emulate real-world banking services. Prior to implementing the banking system into the database, a logical structure must be in place, necessitating the design of a conceptual <strong>Schema</strong> for the bank database.</p><p>Subsequently, the database will be implemented in its entirety. To aid comprehension, the article will also present various examples and SQL queries of the Bank Database.</p><blockquote><strong><em>Schema</em></strong></blockquote><p>The schema can be described as a visual representation or plan of the database that illustrates its logical structure, including how the tables will appear when the database is actually implemented.</p><p>In addition to representing the entity and its relationships, the schema diagram is displayed in table format.</p><p>For instance, a schema diagram is provided below for the banking system, with an arrow extending from the rectangular box representing the connection between them.</p><p>Specifically, there is an arrow from Banker to Branch indicating that the property branch_id refers to the Branch.</p><p>The Schema Contains the following <strong>Tables</strong> of the bank database:</p><ol><li><strong>Customer</strong>, To represent the customers.</li><li><strong>Banker</strong>, To represent the Banker, who manages the entire branch.</li><li><strong>Branch</strong>, To represent a branch of a bank.</li><li><strong>Loan</strong>, To represent the loan granted by the branch to the customer’s account.</li><li><strong>Account</strong>, To represent the bank account of any customer.</li><li><strong>Transaction</strong>, To represent the transactions of customers for any account.</li><li><strong>Credit Card</strong>, To represent the Credit card of any associated customer and account.</li><li><strong>Loan Payment</strong>, To represent the Payment towards the loan.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M2gjtV0xA2CsQUV1mJFs4w.png" /><figcaption>fig.1</figcaption></figure><p>In general, the <strong>schema</strong> provides an overview of the database. Specifically, we will create schemas for the banking database, and once we have visualized them, we can execute <strong>SQL queries </strong>to enhance our understanding of the system.</p><p>Now we will describe the schema of our individual tables;</p><p><strong>Branch Table:</strong> It will represent the branches of a bank.</p><ul><li><strong>branch_id :</strong><br>It is an id given to each branch to identify them uniquely.</li><li><strong>branch_name :</strong><br>The name of the branch.</li><li><strong>branch_address :</strong><br>The address of that particular branch.</li><li><strong>assets :</strong><br>The total assets of that branch.</li></ul><p><strong>Banker Table: </strong>This table represents which banker is managing any particular branch.</p><ul><li><strong>banker_id :</strong><br>It is an id to uniquely identify each banker.</li><li><strong>banker_name :</strong><br>The name of a banker.</li><li><strong>branch_id :</strong><br>The reference id of the branch which is being managed by that particular banker.</li></ul><p><strong>Account Table: </strong>This table is for the customer’s account in the bank.</p><ul><li><strong>account_id:</strong><br>The unique id to identify any account.</li><li><strong>account_balance :</strong><br>The total balance in the account.</li><li><strong>account_type :</strong><br>The type of the account.</li><li><strong>branch_id :</strong><br>The branch with which the account is associated.</li></ul><p><strong>Customer Table: </strong>This table represents the customers of the bank.</p><ul><li><strong>customer_id :</strong><br>The unique id for each customer</li><li><strong>customer_name :</strong><br>The name of the customer.</li><li><strong>dob :</strong><br>Date of birth of the customer.</li><li><strong>mobile no :</strong><br>The mobile number of the customer.</li><li><strong>account_id :</strong><br>The accounts associated with the particular customer.</li></ul><p><strong>Transaction Table: </strong>This table represents the transactions of accounts through any customers of the bank.</p><ul><li><strong>transaction_id :</strong><br>The unique id for each transaction.</li><li><strong>transaction_type :</strong><br>The type of transaction i.e debit/credit.</li><li><strong>amount :</strong><br>The amount of transaction.</li><li><strong>customer_id :</strong><br>The customer who initiated the transaction.</li><li><strong>account_id :</strong><br>The accounts associated with the particular customer.</li></ul><p><strong>Loan Table: </strong>It will represent the loans taken by customers and provided by the branch.</p><ul><li><strong>loan_id :</strong><br>Unique id for each loan.</li><li><strong>issued_amount :</strong><br>The original loan amount was issued by the branch to the customer.</li><li><strong>remaining_amount :</strong><br>The debt amount which is remaining on the customer.</li><li><strong>account_id :</strong><br>The account associated with the loan.</li><li><strong>branch_id :</strong><br>The branch from which the loan was borrowed</li></ul><p><strong>Loan Payment: </strong>The payment for a loan will be represented by this table, each loan payment corresponds to some amount along with the loan id.</p><ul><li><strong>loan_payment_id :</strong><br>The unique id of each payment towards the loan.</li><li><strong>loan_id :</strong><br>The loan which is associated with the payment.</li><li><strong>amount :</strong><br>The amount of payment.</li></ul><p><strong>Borrower Table: </strong>The customers who have taken any loan will be represented by this table. Each borrower id corresponds to a loan id and associated customer along with that loan.</p><ul><li><strong>borrower_id</strong><br>The unique id of each borrower.</li><li><strong>loan_id</strong><br>The loan which is associated with the borrower.</li><li><strong>customer_id</strong><br>The id of the customer who has taken the loan.</li><li><strong>customer_name</strong><br>The name of the customer who has taken the loan.</li></ul><p><strong>Credit Card Table: </strong>This Table represents the credit card and related details for any customer.</p><ul><li><strong>credit_card_id :</strong><br>Unique id to identify any credit card.</li><li><strong>customer_id :</strong><br>The customer associated with the credit card.</li><li><strong>account_id :</strong><br>The account id associated with the credit card.</li><li><strong>expiry_date :</strong><br>The expiry date of the credit card.</li><li><strong>card_limit :</strong><br>The total amount of limit of the card.</li></ul><blockquote><strong><em>Creating Bank Database Tables Using MySQL</em></strong></blockquote><p>The completion of the design phase and conceptual discussions signals the need for implementation. This involves translating the schemas and relations into tables that will represent the skeleton structure within the database. Tables are used to collect related data, with each row representing a data entry known as a tuple. These tuples reflect information about real-world objects. Our approach will involve storing each entity in table form.</p><blockquote><strong><em>Create Database</em></strong></blockquote><pre>CREATE DATABASE banking_system;<br>SHOW databases;</pre><blockquote><strong><em>Show Database</em></strong></blockquote><p>We can view databases with show databases statement</p><pre>SHOW databases;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dyb5N8jClBn0nmdb8U2nJg.png" /><figcaption>fig.2</figcaption></figure><blockquote><strong><em>Create Tables</em></strong></blockquote><p>Here we will create tables corresponding to each entity and their relationship as described in the Schema Diagram.</p><p>Before start writing the queries here is a short description of what you will see in most of the queries.</p><ul><li>The <strong>NOT NULL</strong> written along with the field represents the value for this field and must be provided at the time of insertion of data into the table.</li><li>The <strong>AUTO_INCREMENT</strong> written along with the field represents, the value for that field and will be inserted internally and incremented at each insertion.</li><li>The <strong>VARCHAR</strong>(30) represents that a particular field can store a maximum of 30 characters in that field value.</li><li><strong>PRIMARY KEY</strong>(field) represents that field is going to be the primary key.</li><li><strong>FOREIGN KEY</strong>(field) REFERENCES other_table(key_from_other_table), this syntax is used to refer to another table by using the field as a foreign key.</li></ul><blockquote><em>Branch</em></blockquote><p>This query will create a table named branch having branch id as primary key, branch name, assets, and branch address.</p><pre>CREATE TABLE branch(<br>    branch_id INT NOT NULL AUTO_INCREMENT,<br>    branch_name VARCHAR(30) NOT NULL,<br>    assets INT NOT NULL,<br>    branch_address VARCHAR(255) NOT NULL,<br>    PRIMARY KEY(branch_id)<br>);</pre><blockquote><em>Banker Info</em></blockquote><p>This query will create a table named banker_info, having banker id as a primary key, banker name, and branch id.</p><pre>CREATE TABLE banker_info(<br>    banker_id INT NOT NULL AUTO_INCREMENT,<br>    banker_name VARCHAR(255) NOT NULL,<br>    branch_id INT NOT NULL,<br>    PRIMARY KEY (banker_id),<br>    FOREIGN KEY (branch_id) REFERENCES branch(branch_id)<br>);</pre><blockquote><em>Account</em></blockquote><p>This query will create a table named account, having account id as a primary key, account type, and account balance. This table will refer to the branch table by the foreign key branch id.</p><pre>CREATE TABLE account(<br>    account_id INT NOT NULL AUTO_INCREMENT,<br>    account_type VARCHAR(30) NOT NULL,<br>    account_balance INT NOT NULL,<br>    branch_id INT NOT NULL,<br>    PRIMARY KEY (account_id),<br>    FOREIGN KEY (branch_id) REFERENCES branch(branch_id)<br>);</pre><blockquote><em>Customer</em></blockquote><p>The query written below will create a table named customer which will contain the customer id as primary key, customer name, mobile number, and date of birth. The account id is a foreign key that will be used to refer to the account table and will use to create an association between customers and their accounts.</p><pre>CREATE TABLE customer(<br>    customer_id INT NOT NULL AUTO_INCREMENT,<br>    customer_name VARCHAR(30) NOT NULL,<br>    mobileno VARCHAR(10) NOT NULL,<br>    dob DATE,<br>    account_id INT NOT NULL,<br>    PRIMARY KEY (customer_id),<br>    FOREIGN KEY (account_id) REFERENCES account(account_id)<br>);</pre><blockquote><em>Transctions</em></blockquote><p>The query will create a table named transaction, having transaction id as a primary key, amount, customer id, and account id. This table will refer to the account and customer table by the foreign key.</p><pre>CREATE TABLE transaction(<br>    transaction_id INT NOT NULL AUTO_INCREMENT,<br>    amount INT NOT NULL,<br>    customer_id INT NOT NULL,<br>    account_id INT NOT NULL,<br>    PRIMARY KEY (transaction_id),<br>    FOREIGN KEY (customer_id) REFERENCES customer(customer_id),<br>    FOREIGN KEY (account_id) REFERENCES account(account_id)<br>);</pre><blockquote><em>Credit Card</em></blockquote><p>The query written below will create a table named customer credit card having credit card id as a primary key, expiry date for that credit card, and card limit. The customer id and account id are foreign and will be used to refer to the associated customer and account for any particular credit card.</p><pre>CREATE TABLE customer_credit_card(<br>    credit_card_id INT NOT NULL AUTO_INCREMENT,<br>    expiry_date DATE NOT NULL,<br>    card_limit INT NOT NULL,<br>    customer_id INT NOT NULL,<br>    account_id INT NOT NULL,<br>    PRIMARY KEY (credit_card_id),<br>    FOREIGN KEY (customer_id) REFERENCES customer(customer_id),<br>    FOREIGN KEY (account_id) REFERENCES account(account_id)<br>);</pre><blockquote><em>Loan</em></blockquote><p>This query will create a table loan having loan id as a primary key, issued amount, and the remaining amount. The branch id will be used as a foreign key to refer to the branch that provided the loan and the account id will refer to the account on which the loan is being borrowed.</p><pre>CREATE TABLE loan(<br>    loan_id INT NOT NULL AUTO_INCREMENT,<br>    issued_amount INT NOT NULL,<br>    remaining_amount INT NOT NULL,<br>    branch_id INT NOT NULL,<br>    account_id INT NOT NULL,<br>    PRIMARY KEY(loan_id),<br>    FOREIGN KEY (branch_id) REFERENCES branch(branch_id),<br>    FOREIGN KEY (account_id) REFERENCES account(account_id)<br>);</pre><blockquote><em>Loan Payment</em></blockquote><p>This query will create a table named loan_payment which will have the loan payment id as the primary key and the amount of the payment. The loan id will refer loan table and identify the loan for which payment is being done.</p><pre>CREATE TABLE loan_payment(<br>    loan_payment_id INT NOT NULL AUTO_INCREMENT,<br>    amount INT NOT NULL,<br>    loan_id INT NOT NULL,<br>    PRIMARY KEY (loan_payment_id),<br>    FOREIGN KEY (loan_id) REFERENCES loan(loan_id)<br>);</pre><blockquote><em>Borrower Table</em></blockquote><p>This query will create a table named borrower which will have the borrower id as the primary key, customer id, customer name, and loan id.</p><pre>CREATE TABLE borrower(<br>    borrower_id INT NOT NULL AUTO_INCREMENT,<br>    customer_id INT NOT NULL,<br>    loan_id INT NOT NULL,<br>    PRIMARY KEY (borrower_id),<br>    FOREIGN KEY (loan_id) REFERENCES loan(loan_id),<br>    FOREIGN KEY (customer_id) REFERENCES customer(customer_id)<br>);</pre><p>Also, we can view our schema by selecting any table</p><pre> DESCRIBE banking_system.account;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tfA8iss9pRMSq7Juq476uA.png" /><figcaption>fig.3</figcaption></figure><blockquote><strong><em>Perform Querying</em></strong></blockquote><p>In this section, we will start performing the SQL queries for the banking database.</p><p>Insert data into the branch table:</p><pre>INSERT INTO branch (branch_name, branch_address, assets)<br>VALUES (&#39;ABCD Branch&#39;, &#39;Sector No. 4, City XYZ, 100213, India&#39;, 100000000);<br><br>INSERT INTO branch (branch_name, branch_address, assets)<br>VALUES (&#39;EFGH Branch&#39;, &#39;Street No. 3, Colony No. 9, City GHI, 239811 Uttar Pradesh&#39;, 230000000);<br><br>INSERT INTO branch (branch_name, branch_address, assets)<br>VALUES (&#39;IJKL Branch&#39;, &#39;Apartment No. 87, Near by XYZ Road, City MNO, 192211 Telangana&#39;, 650000000);</pre><p>Insert data into Bankers Table:</p><p>A <strong>banker</strong> is a person who manages the branch we can use a simple insert statement to store the banker&#39;s information in the database.</p><pre>INSERT INTO banker_info (banker_name, branch_id)<br>VALUES (&#39;ABC DEF&#39;, 1);<br><br>INSERT INTO banker_info (banker_name, branch_id)<br>VALUES (&#39;PQR STU&#39;, 3);<br><br>INSERT INTO banker_info (banker_name, branch_id)<br>VALUES (&#39;IJK MNO&#39;, 2);</pre><p>Insert data into Accounts Table:</p><p>To create an account we can insert data in the account table along with providing the necessary information.</p><pre>INSERT INTO account (branch_id, account_balance, account_type)<br>VALUES (1, 0, &#39;savings&#39;);<br><br>INSERT INTO account (branch_id, account_balance, account_type)<br>VALUES (2, 80000, &#39;current&#39;);</pre><p>Insert data into <strong>Customer Table </strong>and associate the customer Table with the Account table:</p><pre>INSERT INTO customer (customer_name, mobileno, dob, account_id)<br>VALUES (&#39;XYZ ABC&#39;, 988324122, &#39;1998-01-31&#39;, 2);<br><br>INSERT INTO customer (customer_name, mobileno, dob, account_id)<br>VALUES (&#39;JKL PQRS&#39;, 898732112, &#39;2000-05-14&#39;, 1);</pre><p><strong>Performing</strong> Transactions on the Account:</p><p>To perform any transaction we can insert the details of the transaction, associated account, and customer with that transaction.</p><p>After inserting data for the transaction, to keep the database consistent we will need to update the balance in the account.</p><pre>INSERT INTO transaction(amount, transaction_type, customer_id, account_id)<br>VALUES (900, &#39;debit&#39;, 1, 2);<br><br>UPDATE account<br>SET account_balance = account_balance - 900<br>WHERE account_id=2;<br><br>INSERT INTO transaction(amount, transaction_type, customer_id, account_id)<br>VALUES (10000, &#39;credit&#39;, 1, 1);<br><br>UPDATE account<br>SET account_balance = account_balance + 10000<br>WHERE account_id=1;</pre><p>Creating Loan for the Accounts:</p><p>We can allocate the loan to any account by inserting related information in the loan table.</p><pre>INSERT INTO loan (branch_id, issued_amount, remaining_amount, account_id)<br>VALUES (2, 10000, 10000,  1);<br><br>INSERT INTO loan (branch_id, issued_amount, remaining_amount, account_id)<br>VALUES (3, 500000, 500000, 2);</pre><p>Issue Credit cards for the Accounts available:</p><p>We can issue the credit card by providing the customer id, account id, and other related information.</p><pre>INSERT INTO customer_credit_card (expiry_date, card_limit, customer_id, account_id)<br>VALUES (&#39;2023-05-21&#39;, 5000, 1, 2);<br><br>INSERT INTO customer_credit_card (expiry_date, card_limit, customer_id, account_id)<br>VALUES (&#39;2025-10-15&#39;, 20000, 2, 1);</pre><p>Changing the Expiry date of the Credit Card:</p><p>The updation of expiry_date or limit can be done with the <strong>UPDATE</strong> clause</p><pre>UPDATE customer_credit_card<br>SET expiry_date = &#39;2034-05-21&#39;, card_limit=10000<br>WHERE customer_id=1;<br><br>SELECT * FROM customer_credit_card WHERE customer_id=1;</pre><blockquote><strong><em>Conclusion of the Project (Bank Management System)</em></strong></blockquote><ol><li>The schema is a logical representation of the organization of data in a database. It defines the tables, fields, and relationships between them. The schema provides a high-level view of the database, and it can be used to analyze the structure and relationships of the data.</li><li>a schema diagram is a more technical structure than an ER diagram. An ER diagram (Entity-Relationship diagram) is a visual representation of entities and their relationships in a database. A schema diagram, on the other hand, provides a more detailed and technical view of the schema, including data types, constraints, and indexes.</li><li>The third point emphasizes the importance of following best practices in database design. The implementation phase, which involves actually creating the database and populating it with data, should come after the schema design. This approach ensures that the database is designed correctly and meets the requirements of the users.</li><li>The schema would include tables for customer information, account information, transaction history, etc. The SQL queries would be used to retrieve, insert, update, and delete data from the database. These queries would be written in the SQL language, which is used to interact with relational databases like the bank database.</li></ol><h4><strong>Happy Learning!</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bd07068bf1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[India ranks as the world’s third-largest producer and consumer of electricity, boasting a national…]]></title>
            <link>https://medium.com/@abhishek_gaur/india-ranks-as-the-worlds-third-largest-producer-and-consumer-of-electricity-boasting-a-national-b7ee252dc?source=rss-cba18bd9d1ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7ee252dc</guid>
            <category><![CDATA[knn-algorithm]]></category>
            <category><![CDATA[matplotlib]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Abhishek Gaur]]></dc:creator>
            <pubDate>Fri, 10 Feb 2023 23:10:17 GMT</pubDate>
            <atom:updated>2023-02-10T23:10:17.485Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Daily Power Generation analysis in India (2017–2020) using EDA</strong></blockquote><p>India ranks as the <strong>world’s third-largest producer</strong> and consumer of electricity, boasting a national electric grid with a capacity of 370.106 GW as of March 31, 2020. The country’s power generation mix is dominated by fossil fuels, particularly coal, which accounted for three-quarters of India’s electricity production in the 2018–19 fiscal year. However, the government aims to shift towards renewable energy, with 35.86% of India’s total installed capacity coming from renewable sources, including large hydroelectric plants.</p><p>Despite having surplus power generation capacity, India faces challenges in distributing electricity to its population. The government’s National Electricity Plan of 2018 states that no new non-renewable power plants are needed in the utility sector until 2027. The government plans to commission 50,025 MW of coal-based power plants while retiring 48,000 MW of old coal-fired plants and adding 275,000 MW of renewable power capacity.</p><p>India’s electricity sector has experienced rapid growth since 1985, growing from 179 TW-hr to 1,057 TW-hr in 2012. The majority of this growth is attributed to coal-fired plants and non-conventional renewable energy sources (RES), while natural gas, oil, and hydro plants have seen decreasing contributions. In the 2019–20 fiscal year, India generated 1,384 billion kWh of electricity (excluding imports from Bhutan), with a 1.0% annual growth compared to the previous year. Renewable energy sources contributed nearly 20% to the total generation. During this year, all incremental electricity generation came from renewable sources, as power generation from fossil fuels declined.</p><p>Driving factors for India’s electricity sector include its rapidly expanding economy, rising exports, improving infrastructure, and increasing household incomes.</p><blockquote><strong>How I scraped data:</strong></blockquote><p>I extracted data from publicly accessible reports of the <strong>National Power Portal</strong>, available at “<a href="https://npp.gov.in/">https://npp.gov.in/</a>&quot;. I created a code for data extraction, which is located in the kernels section of the dataset.</p><blockquote><strong>ML Models used in the analysis:</strong></blockquote><p>In this project, I have used two major Machine Learning models i.e. <strong>Liner-Regression </strong>and <strong>KNN model</strong>.</p><blockquote><strong>Python Code:</strong></blockquote><p>The Jupyter notebook for this project has been uploaded to the GitHub (<a href="https://github.com/Abhishekgaur01/Daily_Power_Generation_in_India-">https://github.com/Abhishekgaur01/Daily_Power_Generation_in_India-</a>) repository, you can have a look at the python code and analyze the visuals created using <strong>matplotlib.pyplot </strong>and <strong>seaborn </strong>library.</p><blockquote><strong>Graph Construction:</strong></blockquote><p>1.) Plotting a graph of all the types of power generation in all of India, with total power generation between 2017–2022.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JP9ty_lhKOizCXL_8A4a6A.png" /><figcaption>fig.1</figcaption></figure><p>the conclusion from the above graph is, <strong>Thermal Generation</strong> is widespread all over India.</p><p>2.) Actual Power vs Estimated Power: using the line plot</p><p><strong>Graph 1:</strong> Thermal Generation Actual vs Thermal Generation Estimated</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_53EEdlm55iWO1NI6Arpw.png" /><figcaption>fig.2</figcaption></figure><p><strong>Graph 2: </strong>Nuclear Generation Actual vs Nuclear Generation Estimated</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OsDrGuAnCj5JtLXrRH286Q.png" /><figcaption>fig.3</figcaption></figure><p>Graph 3: Hydro Generation Actual vs Hydro Generation Estimated</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q5cUDJvJ5a_yjJJ9WoQ8LQ.png" /><figcaption>fig.4</figcaption></figure><p>3.) Plot between Hydro Generation Actual vs Various Regions in India</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jV_o7q_G_Kglll-Ln5zHfg.png" /><figcaption>fig.5</figcaption></figure><p>4.) Plot between Nuclear Generation Actual vs Various Regions in India</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mF6xlSMdBGrU164YIrJ6nQ.png" /><figcaption>fig.6</figcaption></figure><p>5.) Plot between Thermal Generation Actual vs Various Regions in India</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7GHcaTKQ4GRjdTN0QCSl-Q.png" /><figcaption>fig.7</figcaption></figure><p>The <strong>conclusion </strong>drawn from the 3, 4, and 5 points is that in the following graphs, the northern, southern, and western regions use thermal, nuclear, and hydro energy the most, respectively, over the last 3 years in the span of 2018–2020.</p><p>6.) <strong>Searching for Outliers</strong> using the box plot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-fiUFng3mgEmiKzwsV1Nw.png" /><figcaption>fig.8</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmMYcvzsUGqoCJydhMwVNA.png" /><figcaption>fig.9</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ti0FgvRfJ-9aiRXKs26izQ.png" /><figcaption>fig.10</figcaption></figure><p>After looking at fig.8, fig.9, and fig.10 we draw a conclusion that <strong>Nuclear Power</strong> has fewer outliers.</p><p>7.) <strong>Bar charts </strong>of the regions that use the most power generation among the three power plants available:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QUC1cdKJwDTS2-m_sQhVWg.png" /><figcaption>fig.11</figcaption></figure><p>In the above fig.11 Western region uses the most of the Thermal Power plant production and on the other hand, the NorthEastern region uses the least of the Thermal production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EBydTzIcytEH_CxmPZO-8A.png" /><figcaption>fig.12</figcaption></figure><p>In the above fig.12 Northern region uses most of the Hydro Power plant production and on the other hand, the NorthEastern region uses the least of the Hydro energy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ICDieeeumCfbkJkfZyyVQ.png" /><figcaption>fig.13</figcaption></figure><p>In the above fig.13 Southern region uses most of the Nuclear Power plant production and on the other hand, surprisingly the Eastern and NorthEastern region uses the least Nuclear energy.</p><p>8.) Power usage per Region in India:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ngbUQ0VXzzcWR8AiDT9c2Q.png" /><figcaption>fig.14</figcaption></figure><p>In the above fig.14 we can clearly see that <strong>Thermal Energy</strong> is the most used energy among all the Regions in Indian and on the other hand <strong>Nuclear Energy </strong>is the least used.</p><p>If you have come this far by reading this article and you feel that this article provides you with information regarding power production in India, then do provide your comments on which is the most used Power production technology used in India in 2023.</p><p><strong>Happy Learning!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7ee252dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I always wanted to work with some finance dataset and finally, I downloaded the case study of Citi…]]></title>
            <link>https://medium.com/@abhishek_gaur/i-always-wanted-to-work-with-some-finance-dataset-and-finally-i-downloaded-the-case-study-of-citi-d3502e7c8366?source=rss-cba18bd9d1ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3502e7c8366</guid>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[logistic-regression]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[business-analysis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Abhishek Gaur]]></dc:creator>
            <pubDate>Mon, 06 Feb 2023 19:55:01 GMT</pubDate>
            <atom:updated>2023-02-06T19:55:01.605Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong><em>Citi bank loan Exploratory Data Analysis (EDA) using Python</em></strong></blockquote><p>I always wanted to work with some finance dataset and finally, I downloaded the case study of Citi bank from the Kaggle platform, This case study was focused on the EDA and then performing the data visualization task using various Python libraries. Solving this case study will give us an idea of how real business problems are solved using EDA. In this case study, apart from applying the techniques we have learned in EDA, we will also develop a basic understanding of risk analytics in banking and financial services and understand how data is used to minimize the risk of losing money while lending to customers using various different target variables.</p><p>In this project, we have performed three major tasks i.e. Data exploration, Data cleaning, and Data visualization using the various available Python libraries. All the analysis has been performed in the <strong>Jupyter Notebook</strong> terminal.</p><p>I have uploaded the code for this project to the GitHub repository (<a href="https://github.com/Abhishekgaur01/Citi-bank-loan-analysis-using-the-Python">https://github.com/Abhishekgaur01/Citi-bank-loan-analysis-using-the-Python</a>), if anyone wants to get a closer look at the python code they can check my GitHub <a href="https://github.com/Abhishekgaur01">profile</a>.</p><blockquote><strong>STEP 1: Importing all the necessary Python libraries</strong></blockquote><p>The below image all the necessary python libraries which are required in this project. so here we are importing all those libraries in the jupyter notebook. The libraries are as follows:</p><blockquote>import numpy as <strong>np</strong><br>import pandas as<strong> pd</strong><br>import matplotlib.pyplot as <strong>plt</strong><br>import seaborn as<strong> sns</strong></blockquote><blockquote>from sklearn.model_selection import train_test_split<br>from sklearn.datasets import make_classification</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UqSqSh9S3sKrID4bSarOLA.png" /><figcaption>fig.1 Major library to import before starting EDA</figcaption></figure><blockquote><strong>STEP 2: Data Exploration</strong></blockquote><p>Here we will explore the data using various Python codes. All the codes with their respective outputs are attached below.</p><p>Firstly we will import our data on the jupyter notebook using the below python code.</p><pre>#import data<br>loan = pd.read_csv(&quot;loan.csv&quot;)</pre><p>Now we will explore the length and breadth of the dataset using the given below code in the following images.</p><ol><li>) Here will explore the head and tail of the dataset available</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tt1vT4IapFryfe8VFtAPSg.png" /><figcaption>fig.2 Image describe the top 5 and bottom 5 records</figcaption></figure><p>2.) Now we want to know the name of all the columns available in the data set so, we have used<strong> ‘loan.columns’</strong>. Also, using the ‘<strong>loan.shape’</strong> code we are able to understand that there are total <strong>39717</strong> records and<strong> 21</strong> columns in totality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*veyAXu9fnPFAJlQ122VqzA.png" /><figcaption>fig.3 The image above displays distinct names of columns and the shape of the dataset</figcaption></figure><p>3.) Now to understand the data-type of each column provided we have used <strong>‘loan.info()’ </strong>code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*51cKtmTaD_dRM88Qu_O6Cw.png" /><figcaption>fig.4 Image describe the data-types of distinct columns</figcaption></figure><p>4.) Now we want to find out the percentage of null values and also the percentage of row-wise null values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OTWzj-8g_EMX2VNRzGvL2Q.png" /><figcaption>fig.5 The image describe the code to find out percentage of null values column and row wise</figcaption></figure><p>5.) Now we want to describe the statistics of the available columns, here we have used <strong>‘loan.describe()’</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zOXAUZMhOwHE4y-NWkENAw.png" /><figcaption>fig.6 The image above describe the stats of the availabe columns</figcaption></figure><p>6.) Here we want to see some records using the <strong>filter</strong> that we have used in the code below. We just want to see only the 4 top columns and they are as follows: <strong>‘loan_amnt’, ‘term’ , ‘int_rate’ , ‘loan_status’</strong> . Also, we have checked if there are any N/A values in the above mentioned columns or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IeVLTFa__0lL6dfzEqWa6w.png" /><figcaption>fig.7 The image shows the code regarding the lable based filter</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PnpJ2bXpxkalc80E1XgjIQ.png" /><figcaption>fig.8 Here also we have applied the filter to restrict the records that we want to see.</figcaption></figure><p>7.) Here want to see the column named <strong>‘loan_amnt’. </strong>We have analyzed the loan minimum and maximum value in the fig.9. Also, in the fig.10 and fig.11 we have analyzed the 10 smallest loan_amnt and top 10 largest loan_amnt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_AKz1o56DjkjSbZDzabBoA.png" /><figcaption>fig.9 The image describe the column ‘loan_amnt’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cTDfSe8nxFiEvXB0SAH1lg.png" /><figcaption>fig.10 Image describe the top 10 smallest loan_amnt</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8RLc-IM6h5_F7GiOeoC86w.png" /><figcaption>fig.11 Image describe the top 10 largest loan_amnt</figcaption></figure><p>8.) Here we want to describe the column name ‘term’ and search the value count of each term available in the column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pqG7-MA5WA0KEjqpm51IRg.png" /><figcaption>fig.12 Here we described the value count of various terms available in the column ‘term’</figcaption></figure><p>9.) This is the last code we are writing to get info regarding data exploration. Here we want to<strong> sort the data-set</strong> in the ascending fashion of the ‘annual_inc’ column values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9dDch_skOM_JUo3pv-4_A.png" /><figcaption>fig.13 Image describe the sort of dataset in the ascending order of annual_inc</figcaption></figure><blockquote><strong>STEP 3: Data Cleaning</strong></blockquote><ol><li>) Now, we will perform the data cleaning process. Here will drop the column <strong>‘id’ and ‘member_id’ </strong>because they both have <strong>unique values</strong> for all the record mentioned in the dataset. In the next code we want to explore the <strong>null values (N/A) </strong>in the dataset after removing the above two columns.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*evlLp_28zdmrdsfTOEP7zw.png" /><figcaption>fig.14 Here are the first initial steps in the data cleaning process and checking the N/A values.</figcaption></figure><p>2.) Now in the next step after checking the N/A values we will now <strong>drop those N/A</strong> values because they are very less as compared to the length of the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WV9CoKlXE9xDpW4aHRH01w.png" /><figcaption>fig.15 image decribe the code for droping the N/A values.</figcaption></figure><p>3.) Now, after droping the N/A values we will again <strong>describe the dataset</strong> after the initial data cleaning process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfrTedjBM2LClz4KLWngKQ.png" /><figcaption>fig.16 Image describe the dataset after the removal of the N/A values.</figcaption></figure><p>4.) Here we want to convert the data-type of ‘int_rate’ from Object to string. Then after converting the data-type we have used lambda function to split the int_rate column values by ‘%’ sign. Again after the successful split we will convert the data-type from string to ‘float’.</p><p>Now we will do the category split as shown in fig.17 for the int_rate column, by defining a function called int_rate_binning(). The categories are divided as follows:</p><p><strong>#0–8: low int rate<br>#8.1–13: medium int rate<br>#&gt;13: hih int rate</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_F-8y88kAqRNfVBWDRN8g.png" /><figcaption>fig.17 Here we are cerating categories for int_rate column</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7A-oZ7BuyFqSXI4RwK2TQ.png" /><figcaption>fig.18 description of new catergory created by the name int_rate_category</figcaption></figure><p>5.) Now our next step is to covert the annual_inc into three different categories which are as follows:</p><p><strong>#low-income: 0–50000<br>#medium-income : 50001–100000<br>#high-income:100001&gt;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZwbl2AjcmcrKFgPH2Z2wg.png" /><figcaption>fig.19 category split for annul_inc column</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sYsMAmcngyevL-edZVvaDA.png" /><figcaption>fig.20 after the category split we will review the annual_rate_category</figcaption></figure><p>6.) Now we will convert the ‘issue_d’ column into a ‘year’ and ‘month’ column using the lambda function as shown in the fig.21 and fig.22.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5LeWaiffMYKzO-Qikw5Dw.png" /><figcaption>fig.21</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KQOIZ6v0JffaShYj4PxssQ.png" /><figcaption>fig.22 coversion of issue_d into ‘year’ and ‘month’</figcaption></figure><p>7.) Now our next step is to divide the categories for emp_level, here are the three different categories that we have defined for emp_levela and they are as follows:</p><p><strong>0–5 → begineer<br>6–10 → intermediate<br>10+ → expert</strong></p><p>&gt;&gt;Also, we have removed the special characters from the emp_level by defining a function in the fig.24 below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r2nhwAeVYCSVK6NRZx_AaQ.png" /><figcaption>fig.23</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_a7Xun3F8n6H-gJK8IV-eA.png" /><figcaption>fig.24</figcaption></figure><p>8.) Now we will convert the int_rate column into its sub-categories. We have created categories after defining the function called int_rate_binning as shown in the fig.25 and fig.26.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_S-smXEQZIt496p_gLRUbw.png" /><figcaption>fig.25</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pP1Dv62je66qco_PvM-Iaw.png" /><figcaption>fig.26</figcaption></figure><p>9.) Now we will again describe the loan_1 to see our changes that we have made in the dataset and the new columns that we have made will be highlighted with yellow color in the below fig.27.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4_-k5Liv7yngou9bKJtpdw.png" /><figcaption>fig.27</figcaption></figure><blockquote><strong>STEP 4: Data Analysis</strong></blockquote><p>1.) Here we are doing the data analysis using the uni-variate analysis process. Also, in the other Python code we are going to see the description and differnet values for various columns in the dataset shown below in the fig.28.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2FcJFBtpy7YFEu1a8ejsFQ.png" /><figcaption>fig.28</figcaption></figure><p>2.) Now we are going to groupby ‘loan_status’ and ‘int_rate_category’ and count various records in the groupby clause. Alos, in the next code we are going to groupby ‘loan_status’ and ‘emp_level’ as shown in the fig.29. Using the below code we can understand the relationship between the two groupby columns. In the fig.30 we are doing groupby between ‘loan_status’ and ‘purpose’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmpCuO9zVqW0AdI2xappMQ.png" /><figcaption>fig.29</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9mKqoSCFp3Znz1__F45Amg.png" /><figcaption>fig.30</figcaption></figure><p>3.) Here we are going to see the relationship between ‘loan_status’ and ‘verification_status’ with the median values of ‘loan_amnt’ and ‘annual_inc’ in the below fig.31. In the fig.32 we are going to see the realtionship between ‘loan_status’ and ‘verfication_status’ with the median values of ‘loan_amnt’ and ‘annual_inc’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tmODpEM96ZDe1S1cJk6kXw.png" /><figcaption>fig.31</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TnYH8xrhdBxlLHTfRNq9-A.png" /><figcaption>fig.32</figcaption></figure><p>4.) Now in the upcoming step for the data analysis we are going to see the mean and median values for the ‘loan_status’ wrt ‘annual_inc’ and ‘int_rate’ in the fig.33.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8negpdOOvgbLY8LJRskqA.png" /><figcaption>fig.33</figcaption></figure><blockquote><strong>STEP 5: Data Visualization</strong></blockquote><ol><li>) Before starting the visualization process, we are going to import seaborn library as sns.</li></ol><p>Now we are going to construct the first plot using x-axis= ‘loan_status’ and y-axis = ‘count’ (count of loan status) as shown in the fig.34.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PqKtDiQqmdMm1wiVr0oAWg.png" /><figcaption>fig.34</figcaption></figure><p>2.) Now we are going construct the plot using x-axis = ‘int_rate_category’ and y-axis= ‘count’ as shown in the fig.35. Also the 2nd plot in the fig.35 is constructed between ‘annual_inc_category’ and ‘count’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*am8WhlRk7vVaamyzdJDlzw.png" /><figcaption>fig.35</figcaption></figure><p>3.) Now we are constructing an interesting plot between the column ‘purpose’ and on y-axis= ‘count’. we able to see clearly that debt_consolidation has the highest bar in the entire plot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vC4HlwOLyFdnnvZs-A7SuQ.png" /><figcaption>fig.36</figcaption></figure><p>4.) Now we are going to do the uni variate analysis for continuous variable using the distplot. In the first plot (fig.37) we are plot between the ‘int_rate’ and the density of int_rate.</p><p>and In fig.38 we are going to plot the graph between ‘annual_inc’ and the respective density.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6uwAcpMq0I_K_og0u1pGUA.png" /><figcaption>fig.37</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EKOtuWFxhpOpm9RHQjJNYQ.png" /><figcaption>fig.38</figcaption></figure><blockquote><strong>STEP 6: Logistic Regression</strong></blockquote><ol><li>) Now our last step is to perform the logistic regression. Logistic regression aims to solve classification problems. It does this by predicting categorical outcomes, unlike linear regression that predicts a continuous outcome.</li><li>In this article, we will discover the <strong>F1 score</strong>. The F1 score is a machine learning metric that can be used in classification models. Although there exist many metrics for classification models, in the fig.40 we will discover how the F1 score is calculated and when there is added value to use it. The f1 score is a proposed improvement of two simpler performance metrics. In this project the <strong>F1 score</strong> that we are getting is <strong>0.98 </strong>which is an ‘excellent’ score.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnaR5Q7QFfI3V8RCLX5e1Q.png" /><figcaption>fig.39</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJSPNPyxHvIrtH1MJSMC5g.png" /><figcaption>fig.40</figcaption></figure><blockquote><strong>Conclusion:</strong></blockquote><p>After successfully completing this project we can understand the basic components of EDA. We performed major 6 steps and they are as follows;</p><ol><li>)Data Exploration</li><li>)Data cleaning</li><li>)Data Analysis</li><li>)Data visualization</li><li>)Logistic Regression</li></ol><p>The dataset for this project is taken from Kaggle and we have used Jupyter notebook terminal to write the python code.</p><p>If after reading this far you feel that I have contributed a little in the feild of EDA and data analysis, do hit a clap button. Also, if you have any suggestion for me, feel free to write down in the comment box.</p><p>Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3502e7c8366" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Football team Analysis using SQL (Structured Query Language)]]></title>
            <link>https://medium.com/@abhishek_gaur/football-team-analysis-using-sql-structured-query-language-940c34286a22?source=rss-cba18bd9d1ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/940c34286a22</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sql-project]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[business-analysis]]></category>
            <category><![CDATA[sql-programming]]></category>
            <dc:creator><![CDATA[Abhishek Gaur]]></dc:creator>
            <pubDate>Fri, 27 Jan 2023 20:28:45 GMT</pubDate>
            <atom:updated>2023-01-27T20:28:45.874Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong><em>DATABASE MANAGEMENT SYSTEMS PROJECT:</em></strong></blockquote><h4>Football team Analysis using SQL (Structured Query Language)</h4><p>Hi everyone, in this project, we will cover all the crucial topics which come under the heading of DBMS (Database Management System). The Database Management Systems course is structured to provide students with a comprehensive understanding of the principles of database technology. The course highlights database development procedures, data modeling utilizing entity relationship diagrams, database normalization, data definition and manipulation through Structured Query Language, as well as limitations with data security and performance optimization. Through the course’s hands-on methodology, which enables students to learn how to query data, students also gain practical experience with tools such as Oracle SQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*q963FhivuGxgk58k45hqcw.png" /></figure><blockquote><strong><em>Project Overview:</em></strong></blockquote><p>The project objective is to create an English Premier League database schema that will be used to evaluate player performance. This database will include player information, team status, player statistics, matches, player matches, countries, and club countries. These entities will be used to measure a player’s performance relative to the team and other players. The complete project is executed in the <a href="https://iacademy.oracle.com/ords/f?p=4550:1:67069190420:::::"><strong>ORACLE APEX</strong></a> server.</p><blockquote><strong><em>Project Tasks:</em></strong></blockquote><blockquote><strong>Task 0:</strong> Creating a Data Repository</blockquote><p>Here we will first understand what does data repository mean?</p><p>A data repository is also known as a data library or data archive. This is a general term to refer to a dataset isolated to be mined for data reporting and analysis. The <a href="http://www.infotoday.com/cilmag/apr16/Uzwyshyn--Research-Data-Repositories.shtml"><strong>data repository</strong></a> is a large database infrastructure — several databases — that collect, manage, and store data sets for data analysis, sharing, and reporting.</p><p>In our project, we have 7 different tables available so we will create a repository for each table step-by-step. I have highlighted the table name and its respective data attributes.</p><p>In the below image, I have provided the details of all the columns available in the entire data repository including their field description, field type, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xHYsBIwI8cSy1bCnOoDLnA.png" /><figcaption>fig.1 Description of all the columns in the dataset</figcaption></figure><p>1.) PLAYER Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2sN8lBjZ73V4bMCe4VQTSA.png" /><figcaption>fig.2 Description of PLAYER table</figcaption></figure><p>2.) TEAM_STATS Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lFAdyJ_A1hqM1OKZNTxKbQ.png" /><figcaption>fig.3 Description of TEAM_STATS table</figcaption></figure><p>3.) PLAYER_STATS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0a1GZFAya9XtrmPNOXCRA.png" /><figcaption>fig.4 Description of PLAYER_STATS table</figcaption></figure><p>4.) MATCHES Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hy_8mUXDTPGbKXWoYvG45A.png" /><figcaption>fig.5 Description of MATCHES table</figcaption></figure><p>5.) PLAYER_MATCHES Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7GQsXrNVZQ2eSJ3SoeHB8w.png" /><figcaption>fig.6 Description of PLAYER_MATCHES table</figcaption></figure><p>6.) COUNTRIES Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G5qzAiO6YvkIqqS9eHC99w.png" /><figcaption>fig.7 Description of COUNTRIES table</figcaption></figure><p>7.) CLUB_COUNTRIES Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQZ70KKInoGbc68zNWBOcg.png" /><figcaption>fig.8 Description of CLUB_COUNTRIES table</figcaption></figure><blockquote><strong>TASK 1:</strong> Marking Primary Keys and Foreign Keys for Each Relation</blockquote><p>Definitions:</p><p><em>Primary Key</em>- The PRIMARY KEY constraint uniquely identifies each record in a table. Primary keys must contain UNIQUE values and cannot contain NULL values.</p><p><em>Foreign Key</em>- The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables. A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the <a href="https://www.w3schools.com/sql/sql_primarykey.asp">PRIMARY KEY</a> in another table.</p><p><em>Countries → Club Countries</em></p><p>• The primary keys for this relation are country_code for the Countries entity and club for the Club Countries entity.</p><p>• There are no foreign keys in this relation.</p><p><em>Club Countries → Membership</em></p><p>• The primary keys for this relation are a club for the Club Countries entity and Player_ID for the Membership entity.</p><p>• Club is also used as a foreign key in the membership entity. Membership → Player • The primary key for this relation is Player_ID for both the Membership and Player entity.</p><p>• Club is used as a foreign key within both the Membership and Player entities.</p><p><em>Player ⮂ Player Matches ⮂ Matches</em></p><p>• The primary and foreign keys for this relation are MatchID and Player_ID. Each serves as both a piece of a composite primary key and a foreign key to the connected entities. The Primary keys are MatchID for Matches and Player_ID for Player.</p><p>• Club also serves as a foreign key in the player entity.</p><p><em>Player → Player Stats</em></p><p>• The primary keys for this relation are Player_ID for the Player entity and Player_ID plus Position as a composite key for the Player Stats entity.</p><blockquote><strong>TASK 2:</strong> Entity Relationship Diagram</blockquote><p><em>Definition: </em>An Entity Relationship (ER) Diagram is a type of flowchart that illustrates how “entities” such as people, objects or concepts relate to each other within a system.</p><p>Now the below image showcases the Non-Normalized E-R Diagram for the project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LRgflu7IIAsm_Z-JuCUfKA.png" /><figcaption>fig.9 Non-Normalized ER Diagram</figcaption></figure><p>Now the below image portrays the Normalized E-R diagram for the project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mQnaMSqxmznF10ULLXKxyA.png" /><figcaption>fig.10 Normalized ER Diagram</figcaption></figure><blockquote><strong>TASK 3:</strong> Relational Schema</blockquote><ol><li>Unary relationships: There are no unary relationships present in this relational schema</li><li>Binary relationships: There exist 5 binary relationships in this relational schema which are as follows:</li></ol><blockquote>A) Country-to-club countries</blockquote><blockquote>B) Club countries to membership</blockquote><blockquote>C) Membership to player</blockquote><blockquote>D) Player to matches</blockquote><blockquote>E) Player to player stats</blockquote><p>3. Ternary relationships: No ternary relationship</p><p>Constraints that exist in a relationship: No constraints because of the following reasons:</p><p><em>No referential integrity constraint:</em> Associations between tables are defined by foreign keys, we implement this through disallow deletion.</p><p><em>No entity constraints:</em> Each table has a primary key that is not null.</p><p><em>No domain constraints:</em> Domain definitions are consistent with name, meaning, data type, size(length), and allowable values/range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HDQ1yNTrKLBZiJ8wvd9Qgw.png" /><figcaption>fig.11 Non-Normalized Relational Schema</figcaption></figure><blockquote><strong>TASK 4:</strong> Normalization and Dependencies</blockquote><p><em>Database normalization</em> is based on the analysis of functional dependencies which are constraints between two attributes or two sets of attributes. The goal of normalization is to establish well-structured relations devoid of anomalies, inconsistencies, and/or errors that could appear in our database because of updating or modifying relations. Not only that, but data redundancy is also minimized, and data integrity is maintained through the process of normalization, which involves building a relational database in compliance with multiple stages, each of which corresponds to normal form. The normal form is the condition of a relation when specific rules governing relationships between attributes or functional dependencies are fulfilled.</p><ol><li>PLAYER_STATS = Partial Functional Dependency</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tn4WgVtKfPpm_G6DDezvSw.png" /><figcaption>fig.12 Partial Functional Dependency</figcaption></figure><p>Our schema was in 1NF as shown above since it contained no multivalued attributes or repeating groups. It was then transformed to 2NF once we removed the partial functional dependencies. Since the schema was previously in 1NF, that stage will be carried on to the next 2NF stage. Finally, because our schema is in 1NF and 2NF and has no transitive dependencies, we have achieved 3NF. The result will be 1NF, 2NF, and 3NF.</p><blockquote>Now we are all set to write SQL queries after making the E-R diagram and Normalization.</blockquote><blockquote><strong>Queries and Output</strong></blockquote><p><strong>1)</strong> SQL ‘CREATE’ Query for building every relation with Entity Integrity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DibMWQE420Q2q6kYA9JlYw.png" /><figcaption>fig.13 (A) CREATE TABLE queries</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZ_Rmbn4SPvW8jeIkLEY7w.png" /><figcaption>fig.14 (B) CREATE TABLE queries</figcaption></figure><p><strong>2)</strong> SQL ‘UPDATE’ QUERY</p><p>Before Updating the table Player_Position</p><blockquote>SELECT * FROM player_position;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrlXD7eB_qAWQy5i47pIkA.png" /><figcaption>fig.14 (a) Checking the imported data</figcaption></figure><p>After Updating the table Player_Position</p><blockquote>UPDATE player_position SET position = ‘FWD’ WHERE position = ‘FW’;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dv7obZKwxuf6mDE8lLXEOg.png" /><figcaption>fig.15 (b) Update query</figcaption></figure><p><strong>3)</strong> Find the age of the oldest player whose total_goals &gt; 50.</p><blockquote>SELECT MAX(age) from (SELECT * FROM players X JOIN player_stats Y ON X.player_id = Y.player_id WHERE Y.total_goals &gt; 50);</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VdZQB-L6HRBslrjAWCEeoQ.png" /><figcaption>fig.16 Query to find total_goals&gt; 50</figcaption></figure><p><strong>4)</strong> Select the club that has made more goals.</p><blockquote>SELECT * FROM ( SELECT club ,SUM(total_goals) FROM players X JOIN player_stats Y ON X.player_id = Y.player_id GROUP BY X.club ORDER BY SUM(total_goals) DESC ) FETCH FIRST 1 ROWS ONLY;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IUdEz7f0_pypqN840hbd8w.png" /><figcaption>fig.17 Query to find the most goals</figcaption></figure><p><strong>5)</strong> Write a Query Using SUB-QUERY.</p><blockquote>SELECT X.player_id , X.nationality, Y.match_id FROM players X JOIN player_matches Y ON X.player_id = Y.player_id and Y.match_id in ( SELECT match_id FROM matches WHERE winner = ‘Manchester City’);</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LugPsjUZij0xOarKNfXWxg.png" /><figcaption>fig.18 Query using a sub-query</figcaption></figure><h3>Discussion and Conclusions</h3><p>I conducted this project mainly just to practice SQL, as this project was my final submission for the class <strong><em>MGS 613 Database Management Systems</em></strong>, I learned how to make an E-R diagram, business rules, how to find dependencies, and also to do Normalization if required.</p><p>Moreover, it was interesting to explore the dataset using the ORACLE APEX server. I performed all the queries, starting from creating the database and then curating the 7 different tables in the constructed database. after all the initial tasks I performed all the relevant queries necessary for getting the answers to the above-marked questions.</p><p>If you have read this article till this point, I really appreciate your time and effort to patiently stick to the end. If you have any suggestions I eagerly waiting for your comment.</p><p>Thank you! See you in the upcoming article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=940c34286a22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hi! Have you ever wondered if is there a way to get to see movies of your taste that have the best…]]></title>
            <link>https://medium.com/@abhishek_gaur/hi-have-you-ever-wondered-if-is-there-a-way-to-get-to-see-movies-of-your-taste-that-have-the-best-2b0eeca75ceb?source=rss-cba18bd9d1ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b0eeca75ceb</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[sql-server]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Abhishek Gaur]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 18:50:52 GMT</pubDate>
            <atom:updated>2023-01-26T18:50:52.730Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>IMDB: REAL-TIME PROJECT MOVIE REVIEW ANALYSIS</strong></blockquote><p>Hi! Have you ever wondered if is there a way to get to see movies of your taste that have the best rating and interesting genres? If you know a handful of SQL and know how to write queries then ‘YES’ you can choose what kind of movies/web series you want to consume by writing the appropriate SQL query.</p><p>You must be wondering what is SQL?</p><p>When you want to retrieve data from a database, you ask for the data by using Structured Query Language, or SQL. SQL is a computer language that closely resembles English, but that database programs understand. Every query that you run uses SQL behind the scenes.</p><p>Understanding how SQL works can help you create better queries and can make it easier for you to understand how to fix a query that is not returning the results that you want.</p><p>As a student of <strong>MS in Business Analytics</strong> I think this project will provide the basic idea of how to create databases, how to create tables, and how to import the data into the SQL server using the text file (.txt).</p><p>Before starting the movie review analysis, I think it is necessary to provide basic information about the IMDB. IMBD is an online database of movie-related information. IMBD users rate the movies and provide reviews. They rate the movies on a scale of 1 to 5; 1 being the worst and 5 being the best. The dataset also has additional information, such as the release year of the movie. We will analyze the data collected and answer the following questions accordingly.</p><p><strong>Step-by-step</strong> procedure to start querying for the required question:</p><p>For this analysis I am using the PopSQL dashboard to create a database and table, you can use any SQL server to perform the same task. Now, why do I use PopSQL? Here is the answer, PopSQL is a versatile SQL management tool that lets you work and collaborate on multiple database management tasks simultaneously. Visualization of data is very important as it gives a clear picture of your client’s/customers’ data. PopSQL is a very fun tool to write SQL, visualize data, and sharing results. This can be also used as an alternative to MySQL workbench. Let’s begin our work.</p><p><strong>STEP 1:</strong> Create a Database, here I have named my database Testdb1, you can choose any other name of your choice. The following image shows the code we need to write in the terminal to create a database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EruyZUM7wRlyc6mxA3tYdg.png" /><figcaption>fig.1 Create Database</figcaption></figure><p><strong>STEP 2:</strong> In this step, we have to create a table where we can store the data. The CREATE TABLE the statement is used to create a new table in a database.</p><p>Here is the syntax for creating a new table,</p><p>CREATE TABLE <em>table_name </em>(<br> <em>column1 datatype</em>,<br> <em>column2 datatype</em>,<br> <em>column3 datatype</em>,<br> …………………………;</p><p>The following image describes the code regarding creating a table called <strong>‘movies’ </strong>in the PopSQL server<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5zU16uFosan59qUFSYxIw.png" /><figcaption>fig.2 Create Table</figcaption></figure><p><strong>STEP 3: </strong>This step is one of the crucial steps in this project, here we need to import the data in the table movies. The data we are having has been downloaded from the <strong>Kaggle</strong> platform and it is present in the form of text file <strong>(.txt) format</strong>. The following image shows the code for importing the data if the file format is “.txt”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kL23rcImPgd-NOb0SYU_iw.png" /><figcaption>fig.3 Load Data in the Table</figcaption></figure><p>Now after successfully creating the database and table (movies), our next step is to write a basic query for the asked questions regarding the IMDB movie analysis.</p><p>We need to find:</p><p><strong>Q.1) </strong><em>What are the top 5 records in the table “movies”?</em></p><p><strong>Solution:</strong> Here I wrote the query in the MySQL terminal, the following image showcases the solution. To limit our output to the top 5 records I have used LIMIT 5 syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6wRgWxC6d9MLhQdxFmGOxQ.png" /><figcaption>fig.4 Display the top 5 records</figcaption></figure><p><strong>Q.2)</strong> <em>The total number of movies in the dataset?</em></p><p><strong>Solution: </strong>In the solution below I have used the COUNT() function. The COUNT() function returns the number of rows that matches a specified criterion. So there is a total of 49591 records in the table called movies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kd66VeVLtfRyXZ-OCyzcbg.png" /><figcaption>fig.5 Total count of movies</figcaption></figure><p><strong>Q.3)</strong> <em>What is the maximum rating of movies in the dataset?</em></p><p><strong>Solution:</strong> Here in this question I have used MAX() function. The MAX() function returns the largest value of the selected column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*flfpNOlVOJDtaLj-rc5Cyw.png" /><figcaption>fig.6 Display the maximum rating in the movies table</figcaption></figure><p><strong>Q.4)</strong><em> The number of movies that have a maximum rating of 4?</em></p><p><strong>Solution: </strong>Here again I have used the COUNT() function. The below query showcase answer to the above question. there are 6103 records having the rating =4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7yi-1__Q3oZyY4F6JHlQdQ.png" /><figcaption>fig.7 Display the Count of movies having a rating (4).</figcaption></figure><p><strong>Q.5)</strong><em> Name the movies in the dataset with ratings 1 and 2.</em></p><p><strong>Solution: </strong>Here in this question I have used the DISTINCT() function. The SELECT DISTINCT statement is used to return only distinct (different) values. There is a total of 427 records that have a rating of 1,2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCTK9stbcSGxloRPiGfpzg.png" /><figcaption>fig.8 Display names of movies having ratings 1 or 2.</figcaption></figure><p><strong>Q.6)</strong> <em>The list of years and the number of movies released each year in the given dataset?</em></p><p><strong>Solution:</strong> Here we have used COUNT(), DISTINCT(), and GROUP BY functions. The GROUP BY statement groups rows that have the same values into summary rows, like &quot;find the number of customers in each country&quot;.</p><p>The GROUP BY the statement is often used with aggregate functions (COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result set by one or more columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0adX20Y2Vcm24KNMhMiJg.png" /><figcaption>fig.9 List of realized years of a movie and count of movies released in the respective year</figcaption></figure><p><strong>Q.7)</strong> <em>The number of movies that have a runtime of two hours in the given dataset?</em></p><p><strong>Solution:</strong> here we have converted the 2-hour time duration into 2*60*60 seconds. So according to the query applied, we have 2 movies in the dataset having a time duration of 2-hour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVfYJNnoFIcyJbT7tF_-Wg.png" /><figcaption>fig.10 Count of movies having a duration of 2 hours.</figcaption></figure><p><strong>Q.8)</strong> <em>Select the movie/web-series name where the release year = 2011 and the rating of the same is ‘5’.</em></p><p><strong>Solution:</strong> In the below query I have used the LIMIT function to restrict our output to only 2 records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UuDgFqwDqOJiaRqFfvt8cg.png" /><figcaption>fig.11 Movie names having release year = 2011 and rating = 5.</figcaption></figure><p>I believe that this small documentation will help you start your journey in the field of SQL and Database management systems. If there is any suggestion that you have for me you can comment down below.</p><p><strong>Thank you!</strong> if you have read this article to the end, I really appreciate your time. See you in some other similar articles.</p><p><strong><em>#Data_analytics #DBMS #SQL #business_analytics #MySQL #PopSQL</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b0eeca75ceb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>