user-img
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&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
thumbnail
[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
thumbnail
[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