๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB
52
๋ฆฌ๋
์ค ํ๊ฒฝ์์ mysqlํ๊ธฐ ํ์ผ
๋ณดํธ๋์ด ์๋ ๊ธ์
๋๋ค.
2023.12.17
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/mysql
[JAVA] HashMap ์ฌ์ฉ๋ฒ
import java.util.HashMap; import java.util.Iterator; import java.util.Scanner; import java.util.Set; public class HashMapEx { public static void main(String[] args) { HashMap h = new HashMap(); //ํ ์์ ๋ฐ์ Scanner sc = new Scanner(System.in); h.put("Python","ํ์ด์ฌ"); h.put("Java", "์๋ฐ"); h.put("Database", "๋ฐ์ดํฐ๋ฒ ์ด์ค"); Set keys = h.keySet();//์์ ์๋ String์ผ๋ก ํค๋ฅผ ์ง์ Iterator it = keys.iterator(); while(it..
2023.12.14
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
[JAVA] Vector ์ฌ์ฉ
Vector ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ import java.util.Vector; public class VectorEx { public static void main(String[] args) { Vector v = new Vector(4);//์ฌ์ด์ฆ ๋ฏธ์
๋ ฅ ์ ๊ธฐ๋ณธ ์ฌ์ด์ฆ 10 v.add(10); v.add(new Integer(20)); v.add(30); v.add(40); v.add(50); v.add(0,5);//0๋ฒ ์์น์ 5 ์ฝ์
v.remove(0);//0๋ฒ ์์น ์ญ์ for(int i = 0 ; i
2023.12.14
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
[JAVA] StringTokenizer, StringBuffer๋ฅผ ์ด์ฉํ ์์
* ์๋์ ๊ฒฐ๊ณผ๊ฐ ๋์ค๋๋ก 1~4์ ์กฐ๊ฑด์ ๋ณด๊ณ paring๊ณผ StrAppend๋ฅผ ์์ฑํ์ธ์. (ํํธ: parsing-StringTokenizer์ด์ฉ, StrAppend-StringBuffer์ด์ฉ, ๋ฌธ์์ด๊ณผ ์ซ์๋ณํ์๋ Wrapperํด๋์ค ์ด์ฉ) Student ํด๋์ค - ๋ฉค๋ฒ๋ณ์: num, name, c, java, net, tot - ๋ฉ์๋: 1) void parsing(String) ์
๋ ฅ๋ฐ์ ํ์์ ๋ณด๋ฅผ ํ ํฐ ๋จ์๋ก ๋ถ๋ฆฌํ ํ ๊ฐ๊ฐ์ ๋ฉค๋ฒ๋ณ์์ ์ ์ฅํ๋ ๊ธฐ๋ฅ 2) void calTot() ์ด์ ์ ๊ณ์ฐํด์ tot์ ์ ์ฅ 3)void printInfo() ํ์์ ๋ณด๋ฅผ ์ถ๋ ฅ 4) String strAppend() ํ์์ ๋ณด ์ค ํ๋ฒ,์ด๋ฆ,์ด์ ์ ํ๋์ ๋ฌธ์์ด๋ก ๋ง๋ค์ด ๋ฆฌํดํ๋ ๊ธฐ๋ฅ 2. StudentEx ํด๋์ค..
2023.12.14
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
[JAVA] String, StringBuffer, StringTokenizer ํด๋์ค
*์คํธ๋ง ๊ฐ์ฒด๋ ์์ ๋ถ๊ฐ๋ฅ public class StringEx { public static void main(String[] args) { String str1 = "abcd"; String str2 = new String("abcd"); char[] data = {'a', 'b', 'c', 'd'}; String str3 = new String(data); System.out.println(str1); System.out.println(str2); System.out.println(str3); System.out.println(str1.concat("efgh"));//1ํ์ฑ str1 = str1.concat("efgh");//๊ณ์ ์ด์ด์ง๊ฒ ํ๋ ค๋ฉด System.out.println(str1); } ..
2023.12.14
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
[JAVA] Wrapper ํด๋์ค
์๋ฐ์ ๊ธฐ๋ณธ ํ์
์ ํด๋์คํํ 8๊ฐ ํด๋์ค ์ฌ๋ฌ ์ซ์, ๋ฌธ์ ๋ณํ ํ์ฉ public class WrapperEx { public static void main(String[] args) { char c1 = 'A', c2 = 'b', c3 = '1'; System.out.println(Character.isDigit(c3));//์ซ์๋ฅผ ํธ๋ฃจํ์ค๋ก System.out.println(Character.toLowerCase(c1));//๋๋ฌธ์๋ฅผ ์๋ฌธ์๋ก System.out.println(Character.toUpperCase(c2));//์๋ฌธ์๋ฅผ ๋๋ฌธ์๋ก String str = Integer.toString(33);//์ซ์๋ฅผ ๋ฌธ์๋ก ๋ณํ System.out.println(str); str = Integer.t..
2023.12.14
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
[JAVA] Object ํด๋์ค ๊ฐ์ฒด ์ฌ์ฉ
๊ฐ์ฒด๋ฅผ ๋ฌธ์์ด๋ก ๋ณํํ๊ธฐ class Point{ int x, y; Point(int x, int y){ this.x = x; this.y = y; } @Override public String toString() { return "Point("+x+","+y+")"; } } public class ObjectEx { static void print(Object obj) { System.out.println(obj.getClass()); System.out.println(obj.hashCode()); System.out.println(obj.toString()); System.out.println(obj); } public static void main(String[] args) { Point p = ne..
2023.12.14
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
[JAVA] ์ฒดํฌ๋ฐ์ค, ๋ผ๋์ค๋ฐ์ค ์ปดํฌ๋ํธ ๊ตฌํ
์ฒดํฌ๋ฐ์ค import java.awt.Container; import java.awt.FlowLayout; import javax.swing.ImageIcon; import javax.swing.JCheckBox; import javax.swing.JFrame; public class JCheckBoxEx extends JFrame{ JCheckBoxEx(){ setTitle("JCheckBoxEx"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); c.setLayout(new FlowLayout()); ImageIcon cherryIcon = new ImageIcon("cherry.jpg"); ImageIc..
2023.12.08
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
[JAVA] Key ์ด๋ฒคํธ ํ๋ก๊ทธ๋๋ฐ
Key ์ด๋ฒคํธ import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JLabel; public class KeyEventEx extends JFrame{ JLabel []keyMsg = new JLabel[3]; KeyEventEx(){ setTitle("KeyEvent"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); c.s..
2023.12.08
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/Java
mysql๋ก ๊ตฌํํ ๊ฐ์ธ ๊ณผ์
๋ณดํธ๋์ด ์๋ ๊ธ์
๋๋ค.
2023.12.07
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/mysql
[MySQL] C ํ์ผ๊ณผ ์ฐ๋ํด ์คํ์ํค๊ธฐ
๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฐ ํค๋ํ์ผ ๋ณด๊ธฐ mysql_config --libs include์ ํค๋ ํ์ผ๋ค, ์ปดํ์ผ๋ฌ ํ๋๊ทธ ๋ฐ ์ ์๊ฐ ํ์ธ mysql_config --cflags C ์ปดํ์ผํ๊ธฐ ์ํด ํค๋ ์ง์ gcc dbconn.c –o dbconn $(mysql_config –-cflags) $(mysql_config --libs) ์ ์์ ์ํ ์ ๋ณด ์ฝ๋ #include #include #include #include int main() { //MYSQL ๋ณ์ ์์ฑ MYSQL mysql; //MYSQL ๋ณ์ ์ด๊ธฐํ mysql_init(&mysql); //MYSQL์ ์ ์: ์ฑ๊ณตํ๋ฉด 1 ๋ฆฌํด, ์คํจํ๋ฉด 0 ๋ฆฌํด if(!mysql_real_connect(&mysql,"localhost", user, password, ..
2023.12.07
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/mysql
mysql ๋ทฐ์ ์ธ๋ฑ์ค ์ฌ์ฉ๋ฒ
๋ทฐ ์์ฃผ ์ฌ์ฉํ๋ ํํ์ ํ
์ด๋ธ์ ๊ฐ์ ํ
์ด๋ธ๋ก ๊ตฌ์ฑํด์ ์ฌ์ฉํ๊ธฐ ํธํ๊ฒ ํจ! create view cbOrders as select cname, title, odate from cust, orders, book where cust.cid = orders.cid and book.bid = orders.bid; ์ด๋ฐ ์์ผ๋ก ์์ alter view vw_anyang(cid, cname, addr) as select cid, cname, addr from cust where addr = 'seoul'; as select์์ ๋ฐ์ดํฐ๋ฅผ ๋ณ๊ฒฝํ ๋๋ง ์ฌ์ฉ ๊ฐ๋ฅ(๋ฐ์ดํฐ๋ง ๊ฐ๋ฅ!!) ๋ทฐ ์ญ์ ํ๊ธฐ drop view ์ด๋ฆ; ์ธ๋ฑ์ค B-Tree(์ด์งํธ๋ฆฌ)๋ก ๊ตฌ์ฑ๋จ. ์ฐพ๊ธฐ ์ฝ๊ฒ ํ๊ธฐ ์ํด ์์ฑํจ! create index ์ธ..
2023.12.07
๐ฉ๐ปํ๋ก๊ทธ๋๋ฐ&DB/mysql