{"id":33077,"date":"2024-11-01T09:13:36","date_gmt":"2024-11-01T09:13:36","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=33077"},"modified":"2024-11-01T11:29:04","modified_gmt":"2024-11-01T11:29:04","slug":"spring-boot-backend-development-course-database-what-is-a-database","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/33077\/","title":{"rendered":"Spring Boot Backend Development Course, Database, What is a Database"},"content":{"rendered":"<p><body><\/p>\n<p>Welcome to the Spring Boot Backend Development Course. One of the topics of this course is &#8216;Databases&#8217;. When developing web applications, databases are essential, and all data must be stored and managed. In this post, we will start with the basic concepts of databases, and then explore various types, database design, integration with Spring Boot, and how to use SQL in detail.<\/p>\n<h2>1. Definition of a Database<\/h2>\n<p>A database is a system that helps to store and manage information structurally. Users can perform various tasks such as entering, modifying, deleting, and querying data. Databases are generally needed for efficient storage, retrieval, management, and protection of data. Through databases, multiple users can access data simultaneously, ensuring data integrity.<\/p>\n<h3>1.1 Necessity of Databases<\/h3>\n<p>Databases are necessary for many reasons. These include:<\/p>\n<ul>\n<li><strong>Structured Data Management:<\/strong> Databases provide a structure for organizing and efficiently managing data.<\/li>\n<li><strong>Data Integrity:<\/strong> Databases ensure the consistency and accuracy of data.<\/li>\n<li><strong>Concurrency Management:<\/strong> They allow multiple users to access and modify data simultaneously.<\/li>\n<li><strong>Data Security:<\/strong> Databases protect data by setting access controls and user permissions.<\/li>\n<\/ul>\n<h2>2. Types of Databases<\/h2>\n<p>Databases can primarily be classified as follows:<\/p>\n<h3>2.1 Relational Databases (RDBMS)<\/h3>\n<p>Relational databases store data in tabular form. Each table consists of rows and columns, and their relationships are defined by foreign keys. Notable relational database management systems (RDBMS) include MySQL, PostgreSQL, and Oracle.<\/p>\n<h3>2.2 Non-relational Databases (NoSQL)<\/h3>\n<p>Non-relational databases are suitable for storing and managing unstructured data. They can store data in formats such as JSON, XML, documents, and key-value pairs, with a flexible schema. Representative non-relational databases include MongoDB, Cassandra, and Redis.<\/p>\n<h3>2.3 Graph Databases<\/h3>\n<p>Graph databases are optimized for modeling relationships between data. They use nodes and edges to store data and can visually represent complex relationships. Neo4j is a representative example of a graph database.<\/p>\n<h2>3. Database Design<\/h2>\n<p>Database design is essential for building an efficient database. The database design process includes requirement analysis, conceptual design, logical design, and physical design.<\/p>\n<h3>3.1 Requirement Analysis<\/h3>\n<p>The first stage of database design is requirement analysis. Here, we identify the information needed by the users and the business requirements.<\/p>\n<h3>3.2 Conceptual Design<\/h3>\n<p>In the conceptual design stage, the conceptual structure of the data is defined through an ER diagram. This involves identifying &#8216;entities&#8217;, &#8216;attributes&#8217;, and &#8216;relationships&#8217;.<\/p>\n<h3>3.3 Logical Design<\/h3>\n<p>In the logical design stage, the conceptual design is transformed into a data model (typically a relational model). At this stage, the schema of the database is determined.<\/p>\n<h3>3.4 Physical Design<\/h3>\n<p>Finally, in the physical design stage, the logical design is specified according to the actual database system. This process involves optimizations considering performance, including indexing and partitioning.<\/p>\n<h2>4. Integration of Spring Boot and Databases<\/h2>\n<p>Spring Boot provides various features that make it easy to integrate with databases. The process of connecting to a database using Spring Boot includes dependency management, database configuration, defining entity classes, and creating repository interfaces.<\/p>\n<h3>4.1 Dependency Management<\/h3>\n<p>To communicate with a database in Spring Boot, appropriate dependencies must be added. If you are using Maven, the following dependencies should be added to the `pom.xml` file:<\/p>\n<pre>\n<code>\n<dependency>\n    <groupId>org.springframework.boot<\/groupId>\n    <artifactId>spring-boot-starter-data-jpa<\/artifactId>\n<\/dependency>\n<dependency>\n    <groupId>com.h2database<\/groupId>\n    <artifactId>h2<\/artifactId>\n    <scope>runtime<\/scope>\n<\/dependency>\n<\/code>\n<\/pre>\n<h3>4.2 Database Configuration<\/h3>\n<p>To configure the database in Spring Boot, the `application.properties` file must be modified. Here is an example of H2 database configuration:<\/p>\n<pre>\n<code>\nspring.datasource.url=jdbc:h2:mem:testdb\nspring.datasource.driver-class-name=org.h2.Driver\nspring.datasource.username=sa\nspring.datasource.password=\nspring.h2.console.enabled=true\nspring.jpa.hibernate.ddl-auto=update\n<\/code>\n<\/pre>\n<h3>4.3 Defining Entity Classes<\/h3>\n<p>Entity classes must be defined in Spring Boot that map to database tables. For example, a `User` entity that stores user information could be defined as follows:<\/p>\n<pre>\n<code>\nimport javax.persistence.Entity;\nimport javax.persistence.GeneratedValue;\nimport javax.persistence.GenerationType;\nimport javax.persistence.Id;\n\n@Entity\npublic class User {\n\n    @Id\n    @GeneratedValue(strategy = GenerationType.AUTO)\n    private Long id;\n    private String name;\n    private String email;\n\n    \/\/ getters and setters\n}\n<\/code>\n<\/pre>\n<h3>4.4 Creating Repository Interfaces<\/h3>\n<p>Through the Repository interface, you can interact with the database. The `UserRepository` is defined as follows:<\/p>\n<pre>\n<code>\nimport org.springframework.data.jpa.repository.JpaRepository;\n\npublic interface UserRepository extends JpaRepository<User, Long> {\n}\n<\/code>\n<\/pre>\n<h2>5. How to Use SQL<\/h2>\n<p>SQL (Structured Query Language) is the standard language used to interact with databases. With SQL, you can query, insert, modify, and delete data. The basic SQL syntax is as follows:<\/p>\n<h3>5.1 Data Query: SELECT<\/h3>\n<pre>\n<code>\nSELECT * FROM users; \n<\/code>\n<\/pre>\n<h3>5.2 Data Insertion: INSERT<\/h3>\n<pre>\n<code>\nINSERT INTO users (name, email) VALUES ('John Doe', 'john.doe@example.com'); \n<\/code>\n<\/pre>\n<h3>5.3 Data Modification: UPDATE<\/h3>\n<pre>\n<code>\nUPDATE users SET email = 'john.new@example.com' WHERE id = 1; \n<\/code>\n<\/pre>\n<h3>5.4 Data Deletion: DELETE<\/h3>\n<pre>\n<code>\nDELETE FROM users WHERE id = 1; \n<\/code>\n<\/pre>\n<h2>Conclusion<\/h2>\n<p>In this post, we explored the basic concepts of databases, their types, design methods, and integration with Spring Boot. Since databases play a crucial role in backend development, it is important to have a fundamental understanding and practical use of them. In future courses, we plan to cover a variety of topics related to databases, so please look forward to it.<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to the Spring Boot Backend Development Course. One of the topics of this course is &#8216;Databases&#8217;. When developing web applications, databases are essential, and all data must be stored and managed. In this post, we will start with the basic concepts of databases, and then explore various types, database design, integration with Spring Boot, &hellip; <a href=\"https:\/\/atmokpo.com\/w\/33077\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Spring Boot Backend Development Course, Database, What is a Database&#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-33077","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, Database, What is a Database - \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\/33077\/\" \/>\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, Database, What is a Database - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Welcome to the Spring Boot Backend Development Course. One of the topics of this course is &#8216;Databases&#8217;. When developing web applications, databases are essential, and all data must be stored and managed. In this post, we will start with the basic concepts of databases, and then explore various types, database design, integration with Spring Boot, &hellip; \ub354 \ubcf4\uae30 &quot;Spring Boot Backend Development Course, Database, What is a Database&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/33077\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:13:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:29:04+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=\"4\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/33077\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33077\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Spring Boot Backend Development Course, Database, What is a Database\",\"datePublished\":\"2024-11-01T09:13:36+00:00\",\"dateModified\":\"2024-11-01T11:29:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33077\/\"},\"wordCount\":691,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Spring Boot backend development\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/33077\/\",\"url\":\"https:\/\/atmokpo.com\/w\/33077\/\",\"name\":\"Spring Boot Backend Development Course, Database, What is a Database - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:13:36+00:00\",\"dateModified\":\"2024-11-01T11:29:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33077\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/33077\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/33077\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring Boot Backend Development Course, Database, What is a Database\"}]},{\"@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, Database, What is a Database - \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\/33077\/","og_locale":"ko_KR","og_type":"article","og_title":"Spring Boot Backend Development Course, Database, What is a Database - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Welcome to the Spring Boot Backend Development Course. One of the topics of this course is &#8216;Databases&#8217;. When developing web applications, databases are essential, and all data must be stored and managed. In this post, we will start with the basic concepts of databases, and then explore various types, database design, integration with Spring Boot, &hellip; \ub354 \ubcf4\uae30 \"Spring Boot Backend Development Course, Database, What is a Database\"","og_url":"https:\/\/atmokpo.com\/w\/33077\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:13:36+00:00","article_modified_time":"2024-11-01T11:29:04+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":"4\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/33077\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/33077\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Spring Boot Backend Development Course, Database, What is a Database","datePublished":"2024-11-01T09:13:36+00:00","dateModified":"2024-11-01T11:29:04+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/33077\/"},"wordCount":691,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Spring Boot backend development"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/33077\/","url":"https:\/\/atmokpo.com\/w\/33077\/","name":"Spring Boot Backend Development Course, Database, What is a Database - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:13:36+00:00","dateModified":"2024-11-01T11:29:04+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/33077\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/33077\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/33077\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Spring Boot Backend Development Course, Database, What is a Database"}]},{"@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\/33077","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=33077"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33077\/revisions"}],"predecessor-version":[{"id":33078,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33077\/revisions\/33078"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=33077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=33077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=33077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}