mysql | free mysql database| mysql data migration | big MySQL dataset for developer, data analyst

mysql | free mysql database| mysql data migration | big MySQL dataset for developer, data analyst

Database Migration from SQL Server to MySQL

Introduction to Database Migration

  • The session focuses on migrating a database from SQL Server to MySQL, aimed at SQL developers, data analysts, and data scientists for analysis purposes.
  • The presenter received requests to convert an existing SQL Server project (HS Hospital Information Management System) into MySQL for hands-on experience.

Objectives of the Session

  • The main objective is to convert a small SQL Server database into MySQL using the MySQL Workbench tool.
  • A smaller dataset (40,000 records) is chosen for easier conversion instead of the full 1 million records in the original database.

Setting Up MySQL Workbench

  • The presenter navigates through the MySQL Workbench tool and initiates the migration wizard.
  • Connection settings are configured with ODBC Native for connecting to Microsoft SQL Server as the source database.

Configuring Source and Target Databases

  • After testing connections, both source (SQL Server 2016) and target (MySQL 8.0) databases are set up successfully.
  • Schema names are discussed; in this case, "HS_small" is used without "dbo" prefixing table names.

Migration Process Steps

  • Selection of tables for migration occurs; options include migrating table objects and stored procedures.
  • Warnings during migration are noted but no critical issues found; a script file is created for schema creation in MySQL.

Executing Data Transfer

  • The process includes creating a schema in MySQL that acts as a database; successful execution confirms schema transfer.
  • Data copying options are presented: online copy or batch file creation. Online copy selected due to its efficiency.

Finalizing Migration

  • Options exist for truncating tables before data transfer if previous migrations failed; this ensures clean data insertion.
  • A summary of warnings related to date-time formats is provided at completion, indicating successful migration steps taken.

Database Migration and Data Insertion Techniques

Connecting to the Database

  • The speaker demonstrates how to connect to a local database instance, emphasizing the importance of selecting the correct database before executing queries.
  • A query is executed to select data from the "patient" table, with a limit set for retrieving 50,000 records. The output confirms that there are 40,000 records available.

Handling Stored Procedures and Functions

  • Discussion on converting stored procedures between MySQL and SQL Server highlights differences in syntax and functionality. Reference to MySQL documentation is suggested for assistance.
  • The speaker mentions creating a stored procedure for inserting millions of records into the MySQL database, indicating that this process has been successfully completed.

Inserting Patient Data

  • A new SQL query is initiated to create a stored procedure named "insert patient data," which will handle bulk insertion of patient records.
  • The procedure includes parameters for record numbers and utilizes variables to manage data insertion efficiently.

Generating Randomized Data

  • The insert statement incorporates random generation of patient details such as names, gender IDs, dates of birth, and contact numbers. This ensures diversity in the dataset.
  • A method for randomly selecting cities from a predefined list is demonstrated, showcasing how unique identifiers can influence data variability during insertion.

Executing Insertions and Verifying Records

  • After executing the stored procedure for inserting patient data from 40,001 to 50,000 records, confirmation shows an increase in total records within the patient table.
  • Further instructions allow users to insert larger datasets (up to one million records), demonstrating scalability in handling large volumes of data effectively.

Working with Visit Table Records

  • Emphasis on the visit table as crucial due to its transactional nature; it typically contains more records than the master patient table.
  • Instructions are provided on how to insert additional visit records using similar methods as those used for patients while considering potential timeouts during large batch operations.

Database Connection and Timeout Settings

Adjusting MySQL Workbench Timeout

  • The speaker discusses the need to extend the query timeout in MySQL Workbench due to frequent disconnections during queries, which is set at 30 seconds by default.
  • A solution involves navigating to the "Edit Preferences" section of MySQL Workbench and increasing the SQL editor timeout from 600 seconds to 300 seconds (5 minutes).
  • The speaker mentions adjusting a previous setting of 15,000 milliseconds to a new value of 20,000 milliseconds for executing stored procedures.

Database Design Overview

  • After inserting data into the visit table, the focus shifts to database design, emphasizing how to check and save records within various tables.
  • Instructions are provided on using reverse engineering in MySQL Workbench to visualize database structures by selecting specific objects and placing them on a diagram.

Understanding Table Relationships

Analyzing Patient Table Dependencies

  • The patient table's dependencies are highlighted, particularly its connections with City ID and Gender ID.
  • The relationship between patient IDs and visit IDs is explored through SQL queries that demonstrate how these entities interact within the database structure.

Visualizing Database Connections

  • The speaker explains how multiple tables can be analyzed for their relationships, showcasing one-to-many relationships where one patient can have multiple admissions.
  • A demonstration of adding or deleting tables in diagrams illustrates how changes affect visual representations of database relationships.

Service Charges and Billing Structure

Exploring Service Charge Relationships

  • Discussion includes how services relate to charges across different tables like billing and admission, indicating complex interdependencies.
  • It’s explained that each service may incur multiple charges based on visits or admissions, leading up to final bill calculations.

Understanding Invoice Details

  • Insights into invoice structures reveal that they contain charge IDs linked with visit IDs, providing comprehensive details about billing processes related to hospital visits.

Executing SQL Queries for Data Analysis

Query Execution for Hospital Visits

  • The speaker transitions into demonstrating SQL queries relevant for data analysts or scientists working with hospital data.
  • Specific queries are mentioned that allow users to retrieve information about patient visits or admissions effectively.

Practical Application of Queries

  • Emphasis is placed on executing selected queries in MySQL Workbench while encouraging viewers to explore additional questions independently.

Understanding SQL Database Analysis and Data Export

Overview of Patient Data Analysis

  • The discussion begins with the importance of analyzing patient data across various categories, such as company patients and dependent patients. A master table is referenced for clarity in categorization.
  • A brief mention of a video tutorial (approximately 10-11 minutes long) that explains how to understand an existing SQL database, emphasizing the use of group by queries to analyze patient visits by department in 2022.

Analyzing Patient Visits by Department

  • The speaker highlights the ability to execute queries that reveal patient counts per department for different years (2021, 2022, and 2023), showcasing how data analysts or scientists can perform this analysis effectively.

Data Export Process

  • Instructions are provided on exporting data from the server. The process involves clicking on 'data export' and selecting options for data structure along with specifying the SQL file name and its creation location.
  • The speaker concludes by mentioning that they will share the SQL file with viewers, including details about its location within the video for easy access.
Playlists: SQL project
Video description

SQL Server database migrate MySQL Database | big MySQL dataset for developer, data analyst In This Video we are going to learn, 1) SQL Server Database - migrate - MySQL Database 2) Create Database in Mysql -using workbench tool 3) Insert millions of records using SQL Code 4) Database Design in MySQL it will help you in, 1) migration 2) Big Dataset- Data Analyst / Data Scientist / SQL Developer Link of dataset - https://drive.google.com/file/d/1tgI_u2uWqeWSBYU3LCwO7ZP5KuyOxty6/view?usp=sharing Notes / SQL Query link: https://learnsqlwithsagar.blogspot.com Your queries mysql * mysql mysql workbench mysql database mysql database download mysql free download mysql select database mysql studio free mysql database convert sql server to mysql My key Links- 🚀 YouTube Videos- https://www.youtube.com/@mssqlexpert 🌍 My website / blog - https://learnsqlwithsagar.blogspot.com/ 📸 Instagram - https://www.instagram.com/learnsqlwithsagar/ 🚀 YouTube Shorts - https://www.youtube.com/@mssqlexpertshorts/shorts Who am I : Hey guys, I am Sagar, welcome to this channel - #mssqlexpert. this channel is all about learning SQL Server. my goal is to help you in SQL server learning. and Learn complete SQL from basics to Expert Level with an Industrial Knowledge. This SQL course is for beginners who having zero knowledge in SQL. Even those having SQL knowledge they will also get deep information about SQL Language & Microsoft SQL Server (RDBMS). This course will cover how to write SQL Query in MS SQL Server. We will go through a Database, Database Objects (Table, View, Stored Procedure, Function, Trigger, Cursor), Different SQL Queries, Joining, Temp Table, Table Variable, CTE, Indexing, Stats, Query Execution plan, Query Optimization and much more. Please Like, Share, Subscribe, & Comment. Featured playlist https://www.youtube.com/playlist?list=PLqr8f5JwnhhNkfbVXY2gqegUvdimWQjeH https://www.youtube.com/playlist?list=PLqr8f5JwnhhNw9dq2IHC-JEoINWUH6rGF https://www.youtube.com/playlist?list=PLqr8f5JwnhhOoqR6MOoi1K6cZkLzBXuvc https://www.youtube.com/playlist?list=PLqr8f5JwnhhNiLc3wrfntJSLcfw2-0Ivf #mssqlexpert #sql #sql course #data #database #sql server #sqlserver #mssqlserver #RDBMS #sql tutorial #sql full course #sql tutorial for beginners #sql for data analysis #sql for beginners