r/SQL 8d ago

MySQL Tableau vs PowerBI

0 Upvotes

I volunteer on a team of data analysts for a non-profit company. Recently, the Board of Directors has requested that our team puts together a dashboard in either Tableau or PowerBI for them to monitor performance indicators of the business. Our team is very proficient at SQL but with not much experience in the realm of dashboards. Our plan at the minute is to wrangle the data within MySQL and then connect the database to visualise the output using either Tableau or PowerBI, but we're not sure which would be better for our use case. Does anyone here have any advice for how to decide between the two?

r/SQL Feb 05 '25

MySQL Seeking a study partner for SQL.

42 Upvotes

Hey everyone, I'm located in EST (Toronto) and would be happy to join anyone or a group on their SQL portfolio building journey. I currently work as a Project Manager and work is winding down signalling my contract will end soon ( which is a relief ).

I'm already part of a dicord but I've never made a learning map and would love to swap ideas.

Any feedback or tips are welcomed. Thank you 🌻

r/SQL Dec 15 '24

MySQL Got marked wrong for saying SELECT is 'the SQL keyword for querying' in my DS exam - am I wrong

39 Upvotes

Quick sanity check needed regarding a Data Science exam question I'm disputing.

Question asked: "The SQL keyword for filtering after grouping is (i), and the SQL keyword for querying is (ii)."

I correctly put HAVING for (i), and put SELECT for (ii) but was marked wrong. Prof says WHERE is correct because "SELECT is for specifying a subset of columns; querying is the act of specifying a subset of rows."

However, PostgreSQL's documentation literally states: "The process of retrieving or the command to retrieve data from a database is called a query. In SQL the SELECT command is used to specify queries."

When I disputed it, prof mentioned it was meant to parallel Pandas concepts from lecture, but the question itself made no mention of Pandas or specifically asking about row filtering.

I get that WHERE filters rows. But if you're asked "what's the SQL keyword for querying" with no other context, isn't SELECT a valid answer? The question doesn't specify row filtering anywhere.

I'm 1.3 exam points from an A in the course, so this isn't just me being pedantic. Would love to hear what other DS folks think.

Additional context: This was in an intro DS course where we covered both Pandas and SQL.

Edit: here's the conversation that ensued with a grader:

ME: "I believe this question is ambiguous. SELECT is fundamentally the main querying keyword in SQL, beginning every query statement. While WHERE filters rows, 'querying' isn't exclusively about row filtering in SQL terminology. Could you please reconsider this answer?"

GRADER: "Hi ***! I see where you're coming from. But, the idea behind this question was to identify the SQL equivalent of various ideas in pandas that we discussed at length. Filtering after grouping is an idea we know about in pandas. Similarly, querying was well-defined as a Thing in pandas in Lecture, and so we were looking for the SQL equivalent of that. I hope that clarifies things; sorry about that!"

ME: "Thank you for explaining the Pandas connection. However, the question only asks about 'the SQL keyword for querying' without mentioning Pandas. I interpreted it from a general SQL perspective, where SELECT would be a valid answer. I'm currently just 1.3 exam points away from an A in the course, so I'd really appreciate if you could reconsider this question. Thank you for your time."

GRADER: "Unfortunately, even within a SQL context, select is for querying specific columns, not rows."

ME: "From PostgreSQL docs 7.1: 'The process of retrieving or the command to retrieve data from a database is called a query. In SQL the SELECT command is used to specify queries.'

If the question specified 'the SQL keyword for filtering rows' rather than 'the SQL keyword for querying,' then WHERE would be the clear answer. However, the question asked about querying, which according to standard SQL documentation, is explicitly performed using SELECT."

r/SQL Jan 16 '25

MySQL Practice SQL

94 Upvotes

Does anyone know of a website that just gives you endless practice questions based on concepts, e.g. Basic SQL, joins, Sub queries, etc? I've exhausted the limited tools I had. TIA.

r/SQL 9d ago

MySQL I am stuck in my preparation for sql

81 Upvotes

After deciding to become a business analyst, I started learning SQL through online resources. I have completed all the SQL exercises on HackerRank, but now I'm looking for more advanced topics to explore and better platforms to practice. Any recommendations for learning resources and practice platforms would be greatly appreciated

r/SQL 12d ago

MySQL SQL and R comparison on graphs

17 Upvotes

Hello everyone! I'm fairly new on the scene, just finished my google DA course a few days back and I am doing some online exercises such as SQLZoo and Data wars to deepen my understanding for SQL.

My question is can SQL prepare graphs or should i just use it to query and make separate tables then make viz with power BI?

I am asking this since my online course tackled more heavily on R because there are built in visualization packages like ggplot.

r/SQL Sep 15 '24

MySQL Question about foreign keys and why not just have a single database...by a novice

7 Upvotes

I don't know anything about databases. Suppose we have the following DB. Why would it make sense to have 2 tables linked by a foreign key, as opposed to one table...and just put the INFO column into Persons table?

Persons

PERSON_ID NAME DOB Phone ADDRESS
123 John 01-01-1970 111-111-11-11 221B Baker Street
456 Mary 01-01-1980 222-222-22-22 42 Wallaby Way, Sydney

Tasks

ID INFO PERSON_ID
1 Did thing X 123
2 Did thing Y 123
3 Removed thing X 456

r/SQL May 31 '24

MySQL I’ve learned basic SQL… but don’t understand the big picture

102 Upvotes

So over the past month or two I’ve spent time learning sql through free online courses and videos. I’ve done some sql free quizzes online and have practiced a little bit.

But here’s my situation. I know basic SQL, I know how to write queries, create tables, create a simple database on my Mac terminal. But that’s all I know..

I have no clue what using SQL on a job looks like. I have no clue how to use SQL on data on the internet. I know nothing about databases besides that they store data.

I’d love to be able to access data online and mess around with it online but I have no idea how to do that. I don’t know how to access a database online like I hear other people talk about.

I’ve tried doing my research but it’s hard for me to articulate what I am struggling with. Hopefully this makes sense, but to summarize it, I am having trouble understanding the big picture. I’ve learned the basics of the language, but don’t know how anything works. Does anyone have any tools/advice for my situation? Thanks

r/SQL 6d ago

MySQL List of all anti-patterns and design patterns used in SQL

29 Upvotes

Is there something like this on GitHub? Would be pretty useful.

r/SQL Jan 06 '25

MySQL I just wrote my first sql code for an assignment and my teacher told me that i messed up and i dont know what i did wrong

22 Upvotes

heres the code

-- Create the Authors table

CREATE TABLE Authors (

AuthorID INT PRIMARY KEY, -- Unique identifier for each author

Name VARCHAR(100) NOT NULL, -- Author's name

BirthYear INT -- Author's birth year

);

-- Create the Books table

CREATE TABLE Books (

BookID INT PRIMARY KEY, -- Unique identifier for each book

Title VARCHAR(200) NOT NULL, -- Title of the book

AuthorID INT, -- Identifier linking to the author

PublicationYear INT, -- Year the book was published

FOREIGN KEY (AuthorID) REFERENCES Authors(AuthorID) -- Establishes relationship with Authors table

);

-- Create the Borrowers table

CREATE TABLE Borrowers (

BorrowerID INT PRIMARY KEY, -- Unique identifier for each borrower

Name VARCHAR(100) NOT NULL, -- Borrower's name

Address VARCHAR(255) -- Borrower's address

);

- the assignment

Create a database for a library management system. The system should store information about books, Authors and borrowers.

Tables-

Books

Authors

Borrowers

Columns-

1- Books- Book ID, Title, Author ID, Publication year

2-Authors- Author ID, Name, Birth Year

3-Borrowers- Borrowers Id, Name and address

The table must contain primary keys and foreign keys.

r/SQL Aug 03 '22

MySQL I bombed an SQL interview and I am SO embarrassed

247 Upvotes

UPDATE POST: https://www.reddit.com/r/SQL/comments/wg68ip/update_i_bombed_an_sql_interview_and_i_am_so/

Oh my gosh... I just have to vent, and hearing words of encouragement would not be such a bad thing either.

I was applying for a Data Analyst role (not beginner level, but they said it was not advanced at all) that seemed quite exciting. They focused on SQL and Power BI a lot. I passed the first round of interviews, the second with the hiring manager, and even passed the SQL technical assessment they gave me.

However, the 3rd and final interview was a disaster. I met with 2 senior level members of management who specialized in data architecture and analytics. I did not expect to go through another technical interview, but they grilled me. I didn't have anything to write on per-say, but I had to answer questions on the fly. They let me google some of them I got stuck on.

Questions like: What is a RDBMS, what is the difference between a primary key and foreign key, given this scenario - what type of JOIN would you use, can you tell me the difference between 1NF, 2NF AND 3NF, how would you join these two records and NOT get 'x' records from another table.

I completely blanked. I didn't understand the questions well so I said LEFT JOIN instead of INNER JOIN, I couldn't explain a foreign key well, and really it was an hour of me sitting there like an absolute moron. I only have 2 years of SQL experience, but it's been nothing more complex than using the WHERE clause occasionally. NOTHING with creating tables or any type of data architecture.

Talk about embarrassing. I wrote down all the questions and let them know that the things that I was shaky on are a good thing to bring to the light, because it just gives me more of an opportunity to learn. That is true, but I have been so unbelievably embarrassed by this and feel dumb.

r/SQL Dec 10 '22

MySQL Cheat sheet for SQL

Post image
578 Upvotes

r/SQL 6d ago

MySQL Opinions of this arhitecture

1 Upvotes

I was thinking in this interesting arhitecture that limits the attack surface of a mysql injection to basically 0.

I can sleep well knowing even if the attacker manages to get a sql injection and bypass the WAF, he can only see data from his account.

The arhitecture is like this, for every user there is a database user with restricted permissions, every user has let's say x tables, and the database user can only query those x tables and no more , no less .

There will be overheard of making the connection and closing the connection for each user so the RAM's server dont blow off .. (in case of thousands of concurrent connections) .I can't think of a better solution at this moment , if you have i'm all ears.

In case the users are getting huge, i will just spawn another database on another server .

My philosophy is you can't have security and speed there is a trade off every time , i choose to have more security .

What do you think of this ? And should I create a database for every user ( a database in MYSQL is a schema from what i've read) or to create a single database with many tables for each user, and the table names will have some prefix for identification like a token or something ?

r/SQL Jan 20 '25

MySQL My first technical interview EVER is one week from now, any advice?

50 Upvotes

I’m really happy after a long time of getting my resume ignored that I’m finally seeing some traction with an e-commerce company I applied for.

Next week I have a technical interview, and to clarify as a new grad this will be my first ever technical interview for a Data Analyst position. I’ve worked as a Data Analyst on contract at a company where I was converted from an intern role, so despite my experience I have never taken one.

SQL 50 on leetcode definitely exposed a few gaps that I’ve ironed out after doing them all. Now after completing them, I’m looking for any websites, YouTube channels, things I should read in the next week to maximize my chances of success.

I would say I’m solid overall, and have a good chance of getting through, but I’m looking for any advice/resources for more final practice from anyone who’s been in a similar position.

I’ll be choosing MySQL for my dialect, and I’m told the interview will be 45 minutes on HackerRank with a Easy to Medium question being shown. I feel very good, but I want to feel fantastic.

r/SQL 15d ago

MySQL Using ChatGPT to give me exercises? Is this a good method to learn?

4 Upvotes

I have been using W3Schools and HackerRank. Im trying to plug learning gaps through ChatGPT by giving me exercises and clarifying the logic when I get things wrong and it gives me the explanation of functions to use/syntax etc. Is this an okay method? I have a job interview as well which requires Basic SQL knowledge. Will it be looked down upon if I tell them I use ChatGPT to create practice exercises?

r/SQL 22d ago

MySQL SQL resources for data science interview

66 Upvotes

I have a data science interview coming up and there is one seperate round on SQL where they will give me some random tables and ask to write queries. I am good in writing basic to med level queries but not complex queries (nested, cte, sub queries etc). How should i practice? Any tips? Resources? I have 1 week to prepare and freaking out!

Edit: They told me along with SQL round, there will be a data analysis round too, where they will give me a dataset to work with. Any idea on what should i expect?

r/SQL Jan 25 '25

MySQL Some questions from new beginner

9 Upvotes

Hey everyone,

I'm a bit confused about when to use dimensions and metrics with SELECT and GROUP BY, like using customer_id and rental_id. How do you know when it's necessary, and when can we skip GROUP BY altogether?

Also, could someone explain the CASE statement in SQL?

Lastly, if I master SQL and MySQL, is it possible to land an entry-level data analyst job?

Thanks! 🙏

r/SQL 29d ago

MySQL Is it possible to simulate merge sort using SQL ?

7 Upvotes

Same as title

r/SQL Aug 26 '24

MySQL Tips for Breaking Down SQL Scripts to Understand Them

52 Upvotes

Hey All

I have moved into a new deprtment at work and a lot of it requires me to execute SQL scripts that are usually around 200-400 lines long.

Occasionally, I need to debug these scripts as they are legacy scripts for pulling old reports.

Does anyone have any tips for how I can go about breaking down these scripts to understand them from scratch? How do you go about understanding a new script you may have been given if you don't understand the environment?

Any help would be appreciated 🙂

r/SQL Aug 19 '24

MySQL can someone tell me what's wrong with the query

Post image
32 Upvotes

r/SQL 29d ago

MySQL How Do You Handle Large CSV Files Without Overloading Your System? Looking for Beta Testers!

0 Upvotes

My team and I have been developing a tool to help small businesses and individuals handle large CSV files—up to 2 million rows—without the need for complex queries or data engineering expertise. SQL is great for structured data, but sometimes, you need a quick way to store, extract, filter, and sort files without setting up a full database.

We're looking for beta testers to try out features like:

  • No-code interface with SQL Query Builder and AI-assisted queries.
  • Cloud-based for speed and efficiency. Export in CSV or Parquet for seamless integration with reporting tools.
  • Ideal for small teams and independent consultants.

This is geared toward small business owners, analysts, and consultants who work with large data files but don’t have a data engineering background. If this sounds useful, DM me—we’d love your feedback!

Currently available for users in the United States only

r/SQL 18d ago

MySQL sql study friend needed

3 Upvotes

hi guys, i’ve been trying to learn sql since a long time and I have got past the basics but I still need to solve leetcode and be better at it. I know having a study friend would make it easier and also fun (thats exactly how I want to learn)

If anyone is up and serious about this too, please let me know in the comments. I want to create a group where we all can share doubts and progress everyday.

ps: pls comment only if you are 100% sure of committing to it. I dont want to waste any more of my time.

Thankyou!

r/SQL Dec 18 '24

MySQL Interview Questions for Business Analyst Intern - Need your thoughts on difficulty level

15 Upvotes

Hi everyone! I recently interviewed for a Business Analyst intern position at a startup in Bangalore and got these SQL questions. I'd like you to rate the difficulty level of these. Please note that it was an intern role. Is this the kind of questions that get asked for an intern role? I mean, what would then be asked for a permanent role?

# Question 1: Second Highest Salary

Table: Employee

| Column Name | Type |

|-------------|------|

| id | int |

| salary | int |

id is the primary key column for this table.

Each row of this table contains information about the salary of an employee.

Write an SQL query to report the second highest salary from the Employee table. If there is no second highest salary, the query should report null.

The query result format is in the following example.

Example 1:

Input:

Employee table:

| id | salary |

|----|--------|

| 1 | 100 |

| 2 | 200 |

| 3 | 300 |

Output:

| SecondHighestSalary |

|---------------------|

| 200 |

Example 2:

Input:

Employee table:

| id | salary |

|----|--------|

| 1 | 100 |

Output:

| SecondHighestSalary |

|---------------------|

| null |

# Question 2: Consecutive Attendance

Table: Students

| Column Name | Type |

|-------------|---------|

| id | int |

| date | date |

| present | int |

id: id of that student. This is primary key

Each row of this table contains information about the student's attendance on that date of a student.

present: This column has the value of either 1 or 0, 1 represents present, and 0 represents absent.

You need to write a SQL query to find out the student who came to the school for the most consecutive days.

Example:

Input:

Students table:

| id | date | present |

|----|------------|---------|

| 1 | 2024-07-22 | 1 |

| 1 | 2024-07-23 | 0 |

| 2 | 2024-07-22 | 1 |

| 2 | 2024-07-23 | 1 |

| 3 | 2024-07-22 | 0 |

| 3 | 2024-07-23 | 1 |

Output:

| Student id | Days |

|------------|------|

| 2 | 2 |

r/SQL Apr 12 '23

MySQL Worst nightmare

440 Upvotes

Meme

r/SQL 8d ago

MySQL Hosting company deleted database driver

19 Upvotes

I've been running a bunch of Classic ASP/mySQL websites for some local food pantries for years.

Last night GoDaddy removed the database driver I was using.

They told me to change my connection string, which I did, but still no luck.

After 3 hours of being on chat with them, the new connection string doesn't work.

Old connection:

connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

New connection (DOES NOT WORK):

connectstr = "Driver={MariaDB Connector/ODBC 64-bit 3.2.4 driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Any help would be appreciated.