PYQT 요약 11.SQLite 사용


PYQT 요약 11.SQLite 사용

SQLite 기본 사용법 connection = sqlite3.connect(“ db_name.db “) 데이터베이스 파일연결 및 생성, 그리고 객체 생성 cur = connection.cursor() 데이터베이스 객체의 커서 위치를 담는 변수 생성 cur.execute(“CREATE TABLE school(Name text, number int, math_score int) “) cur.execute(“DELETE FROM xxx”) connection.commit() cur.execute(“SELECT *“) res = cur.fetchall() SQL 명령실행과 결과값 얻기 cur.close() <- 커서 반납 connection.close() <- 접속 종료 SQLite 기본명령어 create table : 테이블 생성명령 create table 테이블이름(데이터이름1 데이터형, 데이터이름2 데이터형, 데이터이름3 데이터형, …) cursor.execute(“create ta...


#PCB #기계 #기구부 #아두이노

원문링크 : PYQT 요약 11.SQLite 사용