{"id":33043,"date":"2024-11-01T09:13:21","date_gmt":"2024-11-01T09:13:21","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=33043"},"modified":"2024-11-01T11:29:13","modified_gmt":"2024-11-01T11:29:13","slug":"spring-boot-backend-development-course-what-is-sql","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/33043\/","title":{"rendered":"Spring Boot Backend Development Course, What is SQL"},"content":{"rendered":"<p><body><\/p>\n<p>Spring Boot is a framework that helps to easily develop web applications based on Java. In this tutorial, we will take a detailed look at SQL (Structured Query Language), one of the essential database technologies for Spring Boot backend development. SQL is a standard language for interacting with databases, used for inserting, querying, modifying, and deleting data.<\/p>\n<h2>1. The Necessity of SQL<\/h2>\n<p>Data is an important resource in modern applications. It is essential to store various types of information, such as user information, transaction data, and logs, and to manage them effectively. SQL is a very useful tool for managing these databases, allowing developers to interact efficiently with databases through SQL.<\/p>\n<h2>2. History of SQL<\/h2>\n<p>SQL was developed in the early 1970s by IBM&#8217;s Edgar F. Codd. The initial SQL was designed as a language for managing relational databases, and it was standardized by ANSI (American National Standards Institute) and ISO (International Organization for Standardization) in 1986. Since then, SQL has evolved and is widely used across various database systems.<\/p>\n<h2>3. Basic Structure of SQL<\/h2>\n<p>SQL mainly interacts with databases using statements. Fundamentally, SQL statements can be categorized into CRUD (Create, Read, Update, Delete) operations.<\/p>\n<h3>3.1 CREATE: Data Insertion<\/h3>\n<p>The CREATE command is used to add new data to a database. For example, the SQL statement below inserts a new record into a table containing user information.<\/p>\n<pre><code>INSERT INTO users (username, password, email)\nVALUES ('user1', 'pass123', 'user1@example.com');<\/code><\/pre>\n<h3>3.2 READ: Data Retrieval<\/h3>\n<p>The READ command is used to retrieve data stored in a database. You can use the SELECT statement to fetch data that meets certain conditions.<\/p>\n<pre><code>SELECT * FROM users WHERE email = 'user1@example.com';<\/code><\/pre>\n<h3>3.3 UPDATE: Data Modification<\/h3>\n<p>The UPDATE command is used to modify existing data. The SQL statement below is an example of updating a specific user&#8217;s password.<\/p>\n<pre><code>UPDATE users\nSET password = 'newpass456'\nWHERE username = 'user1';<\/code><\/pre>\n<h3>3.4 DELETE: Data Deletion<\/h3>\n<p>The DELETE command is used to remove records from a database. The following SQL statement is an example of deleting a specific user.<\/p>\n<pre><code>DELETE FROM users\nWHERE username = 'user1';<\/code><\/pre>\n<h2>4. Key Components of SQL<\/h2>\n<p>SQL consists of several components. Here, we will explain the basic components of SQL.<\/p>\n<h3>4.1 Data Definition Language (DDL)<\/h3>\n<p>Data Definition Language includes commands related to the definition of database objects (tables, views, indexes, etc.). Examples of DDL commands include CREATE, DROP, and ALTER.<\/p>\n<h3>4.2 Data Manipulation Language (DML)<\/h3>\n<p>Data Manipulation Language is used to manipulate the data within the database. DML commands include INSERT, SELECT, UPDATE, and DELETE.<\/p>\n<h3>4.3 Data Control Language (DCL)<\/h3>\n<p>Data Control Language is used to manage permissions on data. The GRANT and REVOKE commands fall under this category.<\/p>\n<h2>5. Relational Databases and SQL<\/h2>\n<p>SQL is primarily used in relational databases. Relational databases store data in a tabular format, with each table consisting of rows and columns. Data forms relationships between tables through primary keys and foreign keys, which helps maintain data integrity and consistency.<\/p>\n<h2>6. Spring Boot and SQL<\/h2>\n<p>In Spring Boot, SQL operations can be easily handled through JPA (Java Persistence API). JPA is a standard that simplifies interaction with databases in the object-oriented programming language Java. Using JPA, you can store and retrieve objects without having to write SQL statements directly. Hibernate and other ORM (Object-Relational Mapping) frameworks can be used in this process.<\/p>\n<h3>6.1 Adding Dependencies<\/h3>\n<p>To use JPA in a Spring Boot project, you must first add dependencies via Gradle or Maven. If using Gradle, add the following dependencies to the <code>build.gradle<\/code> file.<\/p>\n<pre><code>dependencies {\n    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'\n    runtimeOnly 'com.h2database:h2' \/\/ If using H2 database\n}<\/code><\/pre>\n<h3>6.2 Defining Entities<\/h3>\n<p>Using JPA, you can define classes (entities) that map to the database. Below is an example of an entity representing user information.<\/p>\n<pre><code>import javax.persistence.Entity;\nimport javax.persistence.GeneratedValue;\nimport javax.persistence.GenerationType;\nimport javax.persistence.Id;\n\n@Entity\npublic class User {\n    @Id\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\n    private Long id;\n    private String username;\n    private String password;\n    private String email;\n    \n    \/\/ Getters and Setters\n}<\/code><\/pre>\n<h3>6.3 Creating Repository Interfaces<\/h3>\n<p>In JPA, interaction with the database is managed through Repository interfaces. Below is an example of a Repository interface for handling user data.<\/p>\n<pre><code>import org.springframework.data.jpa.repository.JpaRepository;\n\npublic interface UserRepository extends JpaRepository<User, Long> {\n    User findByUsername(String username);\n}<\/code><\/pre>\n<h3>6.4 Performing Database Operations<\/h3>\n<p>Database operations can be performed by injecting the Repository into the service class. For example, you can implement a service method for registering a user as follows.<\/p>\n<pre><code>import org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\n\n@Service\npublic class UserService {\n    @Autowired\n    private UserRepository userRepository;\n\n    public User registerUser(String username, String password, String email) {\n        User user = new User();\n        user.setUsername(username);\n        user.setPassword(password);\n        user.setEmail(email);\n        return userRepository.save(user);\n    }\n}<\/code><\/pre>\n<h2>7. SQL Tuning and Optimization<\/h2>\n<p>To perform efficient database operations, SQL tuning and optimization are essential. Here are some basic methods to enhance SQL performance.<\/p>\n<h3>7.1 Using Indexes<\/h3>\n<p>Using indexes can improve data retrieval speed. Indexes enhance search performance on specific columns, and it is advisable to add indexes to columns frequently used in the WHERE clause.<\/p>\n<h3>7.2 Query Optimization<\/h3>\n<p>Complex queries can impact performance. It is best to use simple queries, minimize JOINs, and use JOIN instead of subqueries when possible.<\/p>\n<h3>7.3 Data Normalization<\/h3>\n<p>Normalization helps reduce data redundancy and increase integrity. This allows for efficient design of the database structure.<\/p>\n<h2>8. Conclusion<\/h2>\n<p>In this tutorial, we explored the basic concepts of SQL and its application in Spring Boot. SQL is an important tool for interacting with databases, and Spring Boot makes it easy to integrate with databases. Understanding SQL is essential for backend developers, enabling them to develop efficient and reliable applications. In future tutorials, we plan to cover more advanced topics in Spring Boot and their application in real projects, so we appreciate your continued interest.<\/p>\n<h2>9. References<\/h2>\n<ul>\n<li>SQL Language \u2013 W3Schools: <a href=\"https:\/\/www.w3schools.com\/sql\/\">https:\/\/www.w3schools.com\/sql\/<\/a><\/li>\n<li>Spring Boot Official Documentation: <a href=\"https:\/\/spring.io\/projects\/spring-boot\">https:\/\/spring.io\/projects\/spring-boot<\/a><\/li>\n<li>Java Persistence API: <a href=\"https:\/\/docs.oracle.com\/javaee\/7\/tutorial\/persistence-intro.htm\">https:\/\/docs.oracle.com\/javaee\/7\/tutorial\/persistence-intro.htm<\/a><\/li>\n<\/ul>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot is a framework that helps to easily develop web applications based on Java. In this tutorial, we will take a detailed look at SQL (Structured Query Language), one of the essential database technologies for Spring Boot backend development. SQL is a standard language for interacting with databases, used for inserting, querying, modifying, and &hellip; <a href=\"https:\/\/atmokpo.com\/w\/33043\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Spring Boot Backend Development Course, What is SQL&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[131],"tags":[],"class_list":["post-33043","post","type-post","status-publish","format-standard","hentry","category-spring-boot-backend-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Boot Backend Development Course, What is SQL - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/33043\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot Backend Development Course, What is SQL - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Spring Boot is a framework that helps to easily develop web applications based on Java. In this tutorial, we will take a detailed look at SQL (Structured Query Language), one of the essential database technologies for Spring Boot backend development. SQL is a standard language for interacting with databases, used for inserting, querying, modifying, and &hellip; \ub354 \ubcf4\uae30 &quot;Spring Boot Backend Development Course, What is SQL&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/33043\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:13:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:29:13+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/33043\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33043\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Spring Boot Backend Development Course, What is SQL\",\"datePublished\":\"2024-11-01T09:13:21+00:00\",\"dateModified\":\"2024-11-01T11:29:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33043\/\"},\"wordCount\":825,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Spring Boot backend development\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/33043\/\",\"url\":\"https:\/\/atmokpo.com\/w\/33043\/\",\"name\":\"Spring Boot Backend Development Course, What is SQL - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:13:21+00:00\",\"dateModified\":\"2024-11-01T11:29:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33043\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/33043\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/33043\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring Boot Backend Development Course, What is SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot Backend Development Course, What is SQL - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/33043\/","og_locale":"ko_KR","og_type":"article","og_title":"Spring Boot Backend Development Course, What is SQL - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Spring Boot is a framework that helps to easily develop web applications based on Java. In this tutorial, we will take a detailed look at SQL (Structured Query Language), one of the essential database technologies for Spring Boot backend development. SQL is a standard language for interacting with databases, used for inserting, querying, modifying, and &hellip; \ub354 \ubcf4\uae30 \"Spring Boot Backend Development Course, What is SQL\"","og_url":"https:\/\/atmokpo.com\/w\/33043\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:13:21+00:00","article_modified_time":"2024-11-01T11:29:13+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"5\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/33043\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/33043\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Spring Boot Backend Development Course, What is SQL","datePublished":"2024-11-01T09:13:21+00:00","dateModified":"2024-11-01T11:29:13+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/33043\/"},"wordCount":825,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Spring Boot backend development"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/33043\/","url":"https:\/\/atmokpo.com\/w\/33043\/","name":"Spring Boot Backend Development Course, What is SQL - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:13:21+00:00","dateModified":"2024-11-01T11:29:13+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/33043\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/33043\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/33043\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Spring Boot Backend Development Course, What is SQL"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=33043"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33043\/revisions"}],"predecessor-version":[{"id":33044,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33043\/revisions\/33044"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=33043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=33043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=33043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}