DATABASE 2 - MySQL

MySQL 테이블의 생성

 

댓글

댓글 본문
  1. 바이크
    완료
  2. jwoh
    21-03-26
  3. jeisyoon
    2021.03.06 MySQL 테이블 생성 - 완료
  4. chimhyangmoo
    21.03.03
  5. nugnus
    감사합니다. 오류나던거 해결했네요.
    대화보기
    • 백승철
      21.02.15
    • hanel_
      21.2.12
    • 마아앙
      2021.02.11
    • baeroro
      20210209

      create table topic(
      -> id INT(11) NOT NULL AUTO_INCREMENT, 이름 데이터타입(길이) 공백X 자동으로 증가(중복x)
      -> title VARCHAR(100) NOT NULL,
      -> description TEXT NULL,
      -> created DATETIME NOT NULL,
      -> author VARCHAR(30) NULL,
      -> profile VARCHAR(100) NULL,
      -> PRIMARY KEY(id)); id를 중복X (고유값을 갖게 한다)
    • 나윤채
      ERROR 1064 (42000): You have an error in your SQL syntax; 관련하여
      저도 같은 고생하다가 찾아 공유드립니다.

      해결책 1) 작은따음표 표시를 다 생략하고 적는다.

      해결책 2) 작은따음표(')를 다른것(`)으로 대체한다.

      작은따음표가 두가지가 있습니다.
      ` : 숫자1옆, tab위 (물결과 같은 위치)<-정답
      ' : 엔터 옆,물음표 위 (쌍따음표와 같은 위치)<-오답

      참고: 테이블명, 칼럼명, 프라이머리키안에 들어가는것 해결책1/2안중 하나로 모두 통일되어야함
      대화보기
      • 구운토스트
        2021.1.25 완료
      • 불닭볶음면
        2021. 01. 22
      • 이나라
        DB는 자료의 타입을 설정할 수 있다.

        NULL - > 값이 없는 걸 허용한다.
        PRIMARY KEY(id) - > 고유한 값의 컬럼을 지정, 중복을 허용하지 않는다.
      • user1jena
        재접속 후 CREATE TABLE 진행할 때는 처음 알려주신 것과 같이 database(schema)를 설정해주고 하는 것이죠??
        바로 실행 시 아래 에러가 발생하였고, 다시 database 설정(USE opentutorials) 후 진행 시 정상 실행 됐습니다!:)
        오늘도 상세하고 친절한 강의 고맙습니다~이고잉님 덕분에 수월하게 따라가고 있어요!ㅎㅎ

        [에러 메세지]
        ERROR 1046 (3D000): No database selected

        1. USE opentutorials 로 database 설정한 뒤 CREATE TABLE 다시 실행
        2. 'topic' table이 이미 존재한다는 에러 메세지 확인 -> 테이블 이름 변경 후 실행(topic_2)
        3. 에러 없음 확인
      • 2021.01.08 완료!
      • 김지호
        20 12 30
      • 생활둘기
        2020 12 29
      • kkn1125
        20.12.16 완료~!
      • kkn1125
        영상을 유심히보시면 띄어쓰기를 하십니다.. 저도 헤맸는데 같은간격으로 띄어야하는지는 모르겠지만 띄어쓰기를 하고나니 됩니다..
        대화보기
        • HyeonHui Jeong
          12.13
        • stella
          계속 오류가 나는데... 도대체 왜 그런걸까요 ㅠㅠ
          ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-> id INT(11) NOT NULL AUTO_INCREMENT,
          -> title VARCHAR(100) NOT NULL,
          -' at line 2
          이렇게 떠서 검색해서 찾아보는데도 잘 안 나오네요..
        • 웹짱
          2020.12.09 데이터베이스에 표를 생성하는 구문 CREATE 학습
        • 바부대지
          2020.11.16
        • 콜라
          20201017 완료
        • 낑깡
          CREATE TABLE opentutorials(
          -> id INT(11) NOT NULL AUTO_INCREMENT,
          -> title VARCHAR(100) NOT NULL,
          -> description TEXT NULL,
          -> created DATETIME NOT NULL,
          -> profile VARCHAR(100) NULL,
          -> PRIMARY KEY(id)
          -> );

          저도 계속 오류떠서 이렇게 해보니까 됐어요 ㅠㅠ..!
        • 9/22 수강완료
        • thomaslist
          https://www.ralphlaurenponyoutlet.com Cheapest Polo Ralph Lauren Price
          https://www.air-max2018.us.com Fashion Air Max 97 Store
          https://www.katespadeoutlet-store.us.com Kate Spade Lowest Price Online
          https://www.polorlpony.com Ralph Lauren Dresses Factory Store
          https://www.polooutletsfactorystore.us.com Shop Ralph Lauren Polos Best Sellers
          https://www.katespadenew.com Kate Spade Totes
          https://www.coachus.us.com Coach Wallets outlet online official
          https://www.atlanticpolo.co.uk Ralph Lauren Polo UK
          https://www.polooutletstore.us.org Ralph Lauren Dress For Women
          https://www.katespadeoutletnewyork.us.com Kate Spade enjoy great discount
          https://www.coach-factoryoutletstore.com coach discount codes
          https://www.authenticadidas.com USA Adidas NMD Boost For Women
          https://www.pandoraholiday.com Pandora Necklaces Cheap For Sale
          https://www.newcoachoutlet.com Coach sale New York
          https://www.donedhardy.us.com Ed Hardy official website Cheapest
          https://www.polooutletoutlet.us.com Official Polo Ralph Lauren Shirts
          https://www.atlantichogan.com Hogan Sneakers Reasonable Sale Price
          https://www.katespadeoriginals.com Kate Spade Carry On Sale
          https://www.nikeoutletsfactory.us.com Nike Blazer USA Factory
          https://www.katespadesale.us.com Kate Spade timeless
          https://www.katespademore.com Kate Spade New York
          https://www.ralphlaurenpopular.com Buy Real Ralph Lauren Track Suits
          https://www.katespadestyle.com Kate Spade Shoulder Bags
          https://www.coachsurprise.us.com Coach Wallets Outlet USA
          https://www.supremeny.us.com Supreme Sweatshirts Europe
          https://www.authentic-boost.com Lowest Price Adidas NMD Boost
          https://www.jordanshoes.in.net Nike Blazer Top Designer Collections
          https://www.coach-bags.org us Coach light blue
          https://www.offwhitetshirt.us.com OFF White USA Top Brand Wholesale Online
          https://www.adidasyeezyboost-350.us.com Discounted Adidas Falcon
          https://www.ralphlaurenclassic.org.uk Polo Ralph Lauren ladies white
          https://www.atlanticpandora.com Sale Pandora Gifts Christmas USA Online
          https://www.off-whiteitaly.com Off White Factory Store
          https://www.atlanticralphlauren.com Ralph Lauren Buy Online
          https://www.edhardy.org.uk Ed Hardy Tank authentic quality
          https://www.poloralphoutlet.us.com Super Quality Ralph Lauren Womens Shirts
          https://www.multigroundboots.com Special Soccer Offers
          https://www.lovekillsslowly.us Ed Hardy T Shirts USA
          https://www.coachcolorful.us.com Coach Handbags Sale
          https://www.coachhandbagsoutlets.us.com Largest Fashion Store Coach
          https://www.pandorahearts.us.com Pandora Gifts Amazing Selection
          https://www.ralphlaurencolorfuls.com Ralph Lauren Sale Retailer
          https://www.ggdbitaly.com Golden Goose Sneakers White
          https://www.polooutlet.uk Ralph Lauren Shorts
          https://www.prloutlet.co.uk cheap big Polo Ralph Lauren
          https://www.prloutletclothing.com Shop Ralph Lauren Winter Clothes
          https://www.poloralphlaurenbrand.com Polo Ralph Lauren Competitive Price
          https://www.airmax-97.us.com Nike Air Max Plus USA Fashion
          https://www.pacificsneakers.com Nike Air Jordan Open Store
          https://www.airjordanshoes.in.net Home Nike Air Jordan Outlet
          https://www.jordanshoesforsale.us.com Outlet Nike SB Dunk Online
          https://www.coachoutlet.org.uk Coach Handbags Wholesale UK
          https://www.coachoutlet-handbags.com Coach bags Discount
          https://www.justinairmax.com Nike Air VaporMax USA Online
          https://www.adidas.in.net Newest Adidas Ultra Boost
          https://www.laurenralphlauren.us Reasonable Price Ralph Lauren
          https://www.edhardyoriginals.top Authentic Discount Ed Hardy Suits
          https://www.specialairshoes.com By Fashion Nike Air Max 97
          https://www.coachfactory.uk Coach Shoulder Outlet
          https://www.adidasrealboost.com Adidas Shoes USA Factory Outlet
          https://www.polooutlet.us.com Cheap Clothes Women Ralph Lauren
          https://www.authenticgoldengoose.com Large Discount Golden Goose Francy
          https://www.palace.us.com Palace Jackets Outlet UK
          https://www.cheap-jordansshoes.us.com Nike Air Jordan Sport
          https://www.salomonshoes.in.net Salomon Speedcross Plus
          https://www.usapandorauk.com Pandora Rings Outlet
          https://www.ed-hardy.uk.com cheap prices Ed Hardy UK
          https://www.championoutlet.us.com Champion Factory Outlet Price
          https://www.airjordanmid.com Air Jordan Low For Cheap
          https://www.atlanticcoach.co.uk Cheap Coach Crossbody Outlet
          https://www.adidasmix.com Adidas Yeezy Real Boost 350
          https://www.airjordan4.us.com Nike Air Jordan New York
          https://www.poloralphlaurenpolo.uk.com Ralph Lauren Cheap Prices
          https://www.poloralphlaurenbusiness.com USA Polo Ralph Lauren
          https://www.poloralphlaurensport.com Polo Ralph Lauren Black White
          https://www.kate-spadeoutletstore.us.com Kate Spade macy
          https://www.deepedhardy.com ED Hardy Hoodies Outlet
          https://www.poloralphlauren-sale.us.com USA Ralph Lauren Vest Men
          https://www.edhardysurprise.com ED Hardy Shop Online
          https://www.coachfactory-outlet.com cheap big coach
          https://www.adidas-nmds.us.com Adidas Yeezy Boost Sale
          https://www.atlanticairjordan.com Exclusive Range Air Jordan
          https://www.champions.us.com Champion Short T Shirt
          https://www.edhardys.us New Ed Hardy Products
          https://www.salomonfrance.com Salomon Speedcross GTX for men
          https://www.nike-factory.us.com Air Max 720 USA Online
          https://www.supremeclothingonline.us.com Mens Supreme Clothing
          https://www.scarpehogans.it Unique Hogan Sneakers
          https://www.edhardysoriginals.com Ed Hardy For Women
          https://www.superstaradidas.us.com Adidas Boost Outlet Sale
          https://www.ralphlaurenworldwide.com Discount Polo Ralph Lauren Clothing
          https://www.adidasoriginals.in.net Adidas NMD Boost USA Cheap Sale
          https://www.nikeshoesoutlet.us.org Nike LeBron Great Deals
          https://www.airmaxsurprise.com Nike Air Max 90 For Women
          https://www.edhardy.us.org Ed Hardy Black T Shirts
          https://www.atlanticairmax.com Nike Air Max US In Store
        • 설쿠
          9/18 완료
        • 박지나
          완료 9.15일
        • 유동균
          화이팅!
        • jiyeong
          2020.08.29.
        • 은하파파
          완료 2020.08.26
        • Jonghwo Lee
          완료
        • 김민규
          Spread Sheet 와 SQL의 가장 큰 차이는 '규제'다!
        • クレヨンしんちゃん
          ㅇㄹ
        • zsezse1003
          오늘은 여기까지
        • 완료!
        • 흰색두부김치
          완료
        • Amousk
          테이블 생성 완료.
        • 쑤우
          완료. 감사합니다~
        • 티케이12
          6.2 완료
        • MySQL 테이블의 생성

          어떤 분야든 cheat sheet를 검색해보면 잘정리된 정보 검색 가능

          데이터베이스는 컬럼↓의 데이터 타입을 강제할 수 있음
          ex(ID 컬럼 : 1,2,3,4,5(숫자) / title 컬럼: MySQL,ORACLE(문자)

          MySQL datatype number 확인

          CREATE TABLE topic(
            id INT(11) NOT NULL AUTO_INCREMENT, //c1 datatype(length) -> length: 얼마까지 노출시킬지                       정함,
                                NOT NULL: 값이 없는 것을 허용안함,                       AUTO_INCREMENT: id 값 자동 +1(중복 방지)
            title VARCHAR(100) NOT NULL, //VARCHAR 문자열 데이터타입 선언
            description TEXT NULL, //TEXT 문자열 데이터타입 선언(본문이므로 많은 글자 수 필요) NULL: 값이               없는 것을 허용
            created DATETIME NOT NULL, //DATETIME 날짜 데이터타입 선언
            author VARCHAR(30) NULL,
            profile VARCHAR(100) NULL,
            PRIMARY KEY(id)); //topic 테이블의 id 컬럼이 메인키라는 것을 선언, PRIMARY KEY 1.성능적 측면
                     2.중복을 방지

          데이터베이스 규제 정책 덕분에 원하는 형식으로 깔끔하게 유지하는데 큰 도움
        • jaehyunlee
          05/29 고3 완료
        • 아자요
          데이터베이스 도전

          20.05.26일 / 완료
        • CindyBelita
          완료
        • 아무 오류 없이 완료돼어요 ㅎㅎㅎㅎ
        • 감사합니다 찜찜했는데 해결되었어요!!^^
          대화보기
          • Lucas Trowman
            완료!
          • 김바다
            20/4/24 학습 완료~
          • OneJae EE
            20.04.17 금 / 37세 비전공자 / 완료
          버전 관리
          egoing
          현재 버전
          선택 버전
          graphittie 자세히 보기