0Pricing
Neo4j Graph Database Fundamentals · 강의

Cypher CREATE로 데이터 생성

CREATE 절을 사용하여 Neo4j 그래프 데이터베이스에 새 노드와 관계를 추가하는 방법을 학습합니다.

Cypher CREATE로 데이터 생성은(는) CoddyKit의 무료 Neo4j Graph Database Fundamentals 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Neo4j Graph Database Fundamentals 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Neo4j Graph Database Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Welcome to Cypher CREATE!

In this lesson, you'll learn how to add new data to your Neo4j graph database using the CREATE clause in Cypher, the query language for Neo4j.

We'll cover creating individual nodes, adding properties, and defining relationships between them. Let's get started!

Creating Your First Node

The simplest way to add a node is with CREATE followed by parentheses (). Inside the parentheses, you can give your node a variable name (like n) for later reference in the same query.

Try running this basic example:

CREATE (n)

Adding Labels to Nodes

Nodes usually represent real-world entities, like a 'Person' or a 'Movie'. We use labels to categorize nodes. Labels are defined after the node variable using a colon :.

It's good practice to always use labels for better organization and querying.

CREATE (p:Person)

Nodes with Properties

Nodes often have attributes that describe them. These are called properties. Properties are key-value pairs enclosed in curly braces {} after the label.

  • Keys are strings (like name).
  • Values can be strings, numbers, booleans, or lists.
CREATE (m:Movie {
  title: 'The Matrix',
  releaseYear: 1999
})

Creating Multiple Nodes

You can create several nodes in a single CREATE statement by separating them with a comma ,. This is efficient when adding related data.

Here, we're creating two different types of nodes at once:

CREATE (a:Actor {name: 'Keanu Reeves'}),
       (d:Director {name: 'Lana Wachowski'})

Introducing Relationships

Relationships define how nodes are connected. They are directional and always connect two nodes. Their syntax looks like an arrow ()-[]->().

  • () for nodes.
  • -[]-> for a directed relationship.
  • -[]- for an undirected relationship (less common).

Creating Relationships Between Existing Nodes

To create a relationship between nodes that already exist, you first need to MATCH them. Then, you can use CREATE to define the relationship.

Relationships also have a type (e.g., ACTED_IN) and can have properties.

MATCH (a:Actor {name: 'Keanu Reeves'})
MATCH (m:Movie {title: 'The Matrix'})
CREATE (a)-[:ACTED_IN]->(m)

Relationships with Properties

Just like nodes, relationships can also have properties. These properties describe the relationship itself, not the nodes it connects.

For example, an ACTED_IN relationship might have a role property.

MATCH (a:Actor {name: 'Keanu Reeves'})
MATCH (m:Movie {title: 'The Matrix'})
CREATE (a)-[:ACTED_IN {role: 'Neo'}]->(m)

Creating Nodes and Relationships Together

One of the most powerful features of CREATE is the ability to define new nodes and their relationships in a single statement. This helps build complex graph patterns efficiently.

Here, we create a new 'Person' and a new 'City', connecting them with a LIVES_IN relationship.

CREATE (p:Person {name: 'Samantha'})
       -[:LIVES_IN]->
       (c:City {name: 'London', country: 'UK'})

Putting It All Together

Let's combine what we've learned to build a small graph for a fictional 'Project' and 'Team' members:

  • Create a Project node.
  • Create two Person nodes.
  • Connect the Persons to the Project with WORKS_ON relationships, each with a role property.
CREATE (p:Project {name: 'CoddyKit App', budget: 50000})
CREATE (dev:Person {name: 'Alex', email: 'alex@example.com'})
CREATE (qa:Person {name: 'Jamie', email: 'jamie@example.com'})
CREATE (dev)-[:WORKS_ON {role: 'Developer'}]->(p)
CREATE (qa)-[:WORKS_ON {role: 'QA Engineer'}]->(p)

Quick Check on CREATE

Which of the following Cypher statements correctly creates a new node labeled Product with a name property of 'Laptop' and a price of 1200?

Recap & Next Steps

Great job! You've learned the fundamentals of creating data in Neo4j using the Cypher CREATE clause.

  • You can create nodes with labels and properties.
  • You can define directional relationships between nodes.
  • You can even create nodes and relationships in a single statement.

Next, you'll learn how to find and retrieve this data using the MATCH clause!

자주 묻는 질문

“Cypher CREATE로 데이터 생성” 강의는 무료인가요?

네 — “Cypher CREATE로 데이터 생성” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Neo4j Graph Database Fundamentals 강의 전체를 잠금 해제할 수 있습니다. Neo4j Graph Database Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.

“Cypher CREATE로 데이터 생성”에서 뭘 배우나요?

CREATE 절을 사용하여 Neo4j 그래프 데이터베이스에 새 노드와 관계를 추가하는 방법을 학습합니다. 브라우저에서 직접 실행하는 실습 코드로 Neo4j Graph Database Fundamentals을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Neo4j Graph Database Fundamentals을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Neo4j Graph Database Fundamentals은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“Cypher CREATE로 데이터 생성” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Neo4j Graph Database Fundamentals 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Neo4j Graph Database Fundamentals 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 노드, 관계 및 속성
  2. Cypher CREATE로 데이터 생성
  3. Cypher MATCH로 패턴 일치시키기
  4. RETURN으로 결과 반환하고 구성하기
← Neo4j Graph Database Fundamentals(으)로 돌아가기