목록문제풀기/공통기초부분 (7)
5시간코딩
1. oracle 2. r 3. python
oracle 1. 현재날짜시간 select sysdate,current_date,systimestamp,current_timestamp,localtimestamp from dual; 2.문자 -> 날짜 select to_date('2019-01-15 15:14:13','yyyy-mm-dd hh24:mi:ss') from dual; 3.날짜->문자/숫자 1) select to_char(hire_date,'yyyy-mm-dd hh24:mi:ss.sssss') "년월일시분초", to_char(hire_date,'yyyy"년" yy year') "년", to_char(hire_date,'q"분기"')"분기", to_char(hire_date,'mm month mon')"월", to_char(hire_date,'..
oracle(select, from 생략) r + (::stringr) python(::re) 대문자로 upper(last_name) to_upper('asd') str_to_upper('abc') 'abc'.upper() 소문자로 lower(last_name) to_lower('ASD') str_to_lower('abc') 'ABC'.lower() 첫글자대문자+소문자 initcap(last_name) str_to_title('abc') 'abc'.capitalize() 'ab cd'.title() 'abCD'.swapcase() 문자 letter[1:26] 조회 문자갯수(char/bite) length(last_name) lengthb(last_name) nchar('qwe',type='char') n..
1. oracle select round(45.926,2), round(45.926,1), round(45.926,0), round(45.926), round(45.926,-1) from dual; select trunc(45.925,2), trunc(45.925,1), trunc(45.925,0), trunc(45.925), trunc(45.925,-1) from dual; select ceil(10.1), ceil(10.999), ceil(10.0001), ceil(10.0) from dual; --> ceil(10.0)은 10나오고 나머지는 다 11 나옴 select floor(10.1), floor(10.999), floor(10.0001), floor(10.0) from dual; --> 다 1..
ORACLE 1. export 하기 1-1. sqldeveloper > 도구 > 데이터베이스 익스포트 1-2. spool 2. import 하기 cmd창과 메모장 사용 direct = true 기능 R getwd() setwd("c:/data") .libPaths() #라이브러리 위치임. 그곳에 집적 패키지를 넣을 수 있음 1. text 1-1.읽기 a sql 기존 데이터 삽입(ctas같은) : to_sql import pandas as pd df = pd.read_csv("c:/data/employees.csv") df.to_sql('emp_copy',conn,index=False) c.execute("select * from emp_copy") c.fetchall() 2) sql -> pandas e..
Oracle 1. DQL 1-1. select * from session_privs; select * from user_sys_privs; select * from user_tab_privs; select * from user_users; select * from user_ts_quotas; select * from user_tables; 1-2. select * from employees where employee_id=100; 2. DML(더 있긴하지만, 이정도만) 2-1. insert into emp(employee_id, last_name, salary) values(100,'원대훈',1000000); 2-2. 열을 바꿈 update emp set last_name ='바보' where emplo..