ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [SQL] 내가 추출하고 싶은 데이터가 여러 테이블이 걸쳐 저장되어 있다면
    데이터 분석/DB & SQL 2020. 4. 26. 09:41

    Working With Joins, Aggregations, and Built-In Functions

    https://docs.data.world/documentation/sql/concepts/intermediate/intermediate_intro.html

    내가 추출하고 싶은 데이터가 여러 테이블이 걸쳐 저장되어있을 때에 필요한 기능에 대한 튜토리얼 서두이다. 왜 이런 작업이 필요한지 너무 간결하게 표현되어 있어서 번역하면서 음미해보고 싶었다. 원문과 번역을 동시에 게재하지만, 그 이하 섹션들이 궁금하다면 클릭해서 직접 보자. :D 이 글을 보고 더 많은 사람들이 데이터를 직접 추출할 수 있는 자신감을 얻기를 바란다. 

    Intermediate SQL 에 오신것을 환영합니다!

     

    참고. 번역은 의역본이며, IT 개념을 살릴 필요가 있는 어휘는 본문 내 첫 표기 시 영어 원문을 병기했다. JOIN 만 영어 그대로 표기했다. 

     

    Working With Joins, Aggregations, and Built-In Functions

    Learn how to query multiple tables in this SQL tutorial. Visit for a full course on learning the basics of SQL.

    docs.data.world

     


    An introduction to the terminology used in querying multiple tables simultaneously.

    복수 개의 테이블에 동시에 질의하는데 쓰이는 용어에 대한 소개

     

    Stepping Up Your Game

    Up till now we’ve queried data in one table in a dataset at a time. While there is information to be had from single-table queries, you can do so much more if you can pull bits of data from different tables and present it all together in one result set.

    지금까지 우리는 동시에 하나의 dataset 의 하나의 table 에서 데이터를 질의 query 했다. 하나의 테이블에서 정보를 가져오는 경우도 있지만, 다른 테이블에 있는 데이터 일부분을 가져와서 하나의 result set 을 질의 및 추출하는 경우가 훨씬 더 많다. 

     

    You might wonder, if storing all the data in a dataset in one table works, why bother to split it up into multiple tables across the dataset? Why not just leave it all in one huge table? The short answer is for efficiency and for the integrity of the data. It’s what differentiates a relational database from a spreadsheet. Large enterprise data especially will be stored in many different tables that you will want to access from a single query.

    하나의 테이블에 모든 데이터를 저장해도 된다면, 왜 굳이 데이터셋을 여러 테이블에 나누어서 저장하는걸까? 효율성 efficiency 과 e데이터 무결성* integrity 때문이다. 이 것이 관계형 데이터베이스 relational database 와 스프레드시트 spreadsheet 의 차이점이다. 대기업들은 특히 데이터를 무수히 많은 테이블에 저장하여, 당신이 하나의 쿼리로 접근할 수 있게 한다. 

     

    Basic Terminology

    Running queries against multiple tables at a time requires the use of joins. There are several ways to specify the conditions used to create joins, and there are also types of joins which differ in the amount and original location of the data being queried. Joins are the mechanism used to link tables in a dataset together for the duration of a query so that related data in the linked tables can be combined into one query-result table. There are several different types of joins which each describe a different relationship between the joined tables, and we will examine them in depth in the following sections.

    여러 테이블에 쿼리를 실행시키려면 조인 JOIN 을 사용해야 한다. JOIN 을 사용하기 위해 조건을 구체화하는 데에는 여러 방안들이 있으며, 질의 대상인 데이터의 규모과 위치에 따라 사용해야하는 JOIN 의 유형도 다르다. JOIN 은 질의하는 동안 데이터셋 내의 여러 테이블을 연결하는 메커니즘이며, 연결된 테이블에서 관계를 맺은 데이터들을 질의결과로 조합할 수 있다. JOIN 된 테이블 간의 관계에 따라 JOIN의 유형이 달라지며, 우리는 이하의 섹션에서 이에 대해 더 자세히 살펴볼 것이다. 

    즉, JOIN 은 질의하는 동안 여러 테이블의 데이터를 연결/조합하여 질의결과를 제공하며, 데이터의 규모과 위치에 따라 유형을 다르게 적용해야 한다.

     

    As you add more data into your results there will be times when, instead of seeing all the rows in a table, you might want to see a sum, or average, or count across rows. This functionality comes from creating data groups, or aggregations from the use of aggregate functions.

    데이터로 결과를 추출할 때, 테이블 내의 모든 행을 살피는 대신 행의 합계, 평균, 갯수를 보고싶을 때도 있다. 이 기능은 데이터 그룹 data groups 를 생성하거나 집계함수 aggregate functions 를 통한 집계 aggregations 를 통해 얻을 수 있다. 

     

    In addition to combining tables you can also combine queries. This functionality is mostly of value when you are trying to get information from datasets which are not optimally designed for the queries you need to run.

    테이블을 결합하는 거 외에도 쿼리를 결합할 수도 있다. 이 기능은 실행시킬 쿼리에 최적으로 설계되지 않은 데이터셋에서 정보를 얻을 때 유용하다.

     

    Finally there are times when you might need to manipulate the data in strings or date format for your query. SQL has a host of built-in functions created specifically for that purpose.

    마지막으로 당신의 질의를 위해 문자열 string 이나 날짜 date 형식의 데이터에 대해서 조작이 필요할 때도 있다. SQL 은 이를 위해 많은 내장함수 built-in function 를 지원한다.

     

    In the following sections we will explore joins, aggregation, additional expressions, combining queries, and built-in functions in depth.

    이어지는 섹션에서 우리는 JOIN, 집계, 추가적인 표현, 쿼리 결합, 그리고 내장함수에 대해 더 자세히 알아볼 것이다. 

     

    (끝)

     


    *데이터 무결성: 데이터의 라이프사이클 내 신뢰도와 관련되어 있다. 데이터의 상태 (유효/무효)나 데이터의 유효성과 정확성을 보장하는 프로세스를 의미할 때도 있다. 데이터 무결성을 위한 일반적인 프로세스의 예시로 에러 체크나 유효성 검증가 있다.    

    Data integrity refers to the reliability and trustworthiness of data throughout its lifecycle. It can describe the state of your data—e.g., valid or invalid—or the process of ensuring and preserving the validity and accuracy of data. Error checking and validation, for example, are common methods for ensuring data integrity as part of a process.

    https://www.varonis.com/blog/data-integrity/

     

    What is Data Integrity and How Can You Maintain it?

    Interested in learning more about data integrity? Get the overview complete with information on why it's important and how to maintain it! Learn more here. 

    www.varonis.com

     

     

    댓글

Designed by Tistory.