CREATE TABLE `order` ( id INT PRIMARY KEY, order_name VARCHAR(20) NOT NULL, product_name VARCHAR(20) NOT NULL, quantity INT NOT NULL, order_date DATE NOT NULL);INSERT INTO `order` (id, order_name, product_name, quantity, order_date) VALUES(1, '홍길동', '피자', 2, '2022-02-26'),(2, '김영희', '치킨', 3, '2022-02-26'),(3, '이철수', '햄버거', 1, '2022-02-27'),(4, '박지민', '스테이크', 2, '2022-02-27'),(5, '최영희', '짬뽕'..
분류 전체보기
-- student 샘플 데이터 INSERT INTO student (student_id, name, grade, major)VALUES (2, '박영희', 2, '경영학과'), (3, '이민수', 4, '전자공학과'), (4, '홍길동', 1, '디자인학과'), (5, '임성민', 3, '컴퓨터공학과'), (6, '한지원', 2, '경영학과'), (7, '박준형', 4, '전자공학과'), (8, '김민지', 1, '디자인학과'), (9, '이현수', 3, '컴퓨터공학과'), (10, '정미경', 2, '경영학과'), (11, '김성진', 4, '전자공학과'), (12, '임승환', 1, '디자인학과'); select * from student; INSERT INTO student (..
-- 테이블을 삭제하는 명령 -- drop table student; -- 테이블 생성시에 디폴트 값을 제약 설정하는 방법 create table student( student_id int primary key, name varchar(50) not null, grade int not null, major varchar(50) default '미정' not null); desc student;-- 기본 문구 모양 -- INSERT INTO 테이블명(컬럼명1, 컬럼명2, ...) VALUES(값1, 값2, ...); -- INSERT INTO 테이블명 VALUES (값1, 값2, ...); - 생략 버전 insert into student(student_id, name, grade,..
·Java
use demo3;create table user( id int auto_increment primary key, name varchar(100) not null, email varchar(100) null);select * from user;package ch05;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.SQLException;public class BatchExample { public static void main(String[] args) { String url = "jdbc:mysql://localhost:3306/demo3?s..