본문 바로가기

MySQL19

[Rust] MySQL 연결 및 Data 적재 (62일차) (1) 아래 글을 참조하여 root 사용자 말고, 새로운 사용자를 만들어 권한을 주자. https://printscanf.tistory.com/entry/Error-MySQL-Access-denied-for-user-useridlocalhost (2) 해당 Rust 파일 디렉토리에 mysql 의존성을 추가 $ cargo add mysql (3) 테이블 생성 및 Data 적재 예시 use mysql::prelude::*; use mysql::*; fn main() -> Result { // Set up a new database connection let url = "mysql://id:pswd@localhost:3306/moto"; let pool = Pool::new(url)?; // Create a .. 2023. 3. 26.
[MySQL] Partition 예제 ==> PARTITION 할 때 Column 하나에만 Primary Key 를 걸면 Error 발생. ==> 모든 Column 을 Partition 해야함. CREATE TABLE sales ( sales_id INT, sales_date DATE, amount INT, PRIMARY KEY (sales_id, sales_date, amount) ) PARTITION BY RANGE(YEAR(sales_date)) ( PARTITION p_2015 VALUES LESS THAN (2016), PARTITION p_2016 VALUES LESS THAN (2017), PARTITION p_2017 VALUES LESS THAN (2018), PARTITION p_others VALUES LESS THAN .. 2023. 1. 30.
[MySQL] With 예제 WITH RECURSIVE cte (n, fibonacci) AS ( SELECT 1, 1 UNION ALL SELECT n + 1, fibonacci + cte.fibonacci FROM cte WHERE n with를 통해 조건_1로 필터링 한 data를 조건_2로 다시 필터링 WITH cte AS ( SELECT * FROM table_1 WHERE condition_1 ) SELECT * FROM cte WHERE condition_2; https://chat.openai.com/chat 2023. 1. 29.
[MySQL] Stored Program - Database Server 내에 저장 및 실행되는 Computer Program. ==> Source Code 와 (종종) Stored Program의 Compile 버전이 거의 항상 Database Server System Table에 보관됨. ==> Database Server의 Process 혹은 Thread 의 메모리 주소 안에서 Program이 실행됨. - 종종 Stored Module 혹은 Stored Routine 으로 불림. - Stored Procedure, Stored Function, Trigger 등을 아우르는 상위 개념. 1) Stored Procedures - Stored Program 에서 가장 흔한 Type. - 요청시 실행되며 또한 여러 번의 Input/Output P.. 2022. 12. 5.