Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
準備面試
Search
滋滋桑
March 01, 2023
390
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
準備面試
就是面試考題
https://youtu.be/WDVCQnh2LEk
滋滋桑
March 01, 2023
More Decks by 滋滋桑
See All by 滋滋桑
以圖搜圖系統開發技術分享
tzutzu
0
19
碳足跡_python.pdf
tzutzu
0
19
使用JavaScript製作互動式網頁導覽列
tzutzu
0
25
Laravel 8 的使用方式
tzutzu
0
31
SPRING BOOT+VUE+資料庫到底是甚麼
tzutzu
0
79
asp.net用北風資料庫來說明實用技術
tzutzu
0
130
資料庫是什麼
tzutzu
0
52
如何準備證照考試
tzutzu
0
130
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
510
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
320
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Producing Creativity
orderedlist
PRO
348
41k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
360
The Mindset for Success: Future Career Progression
greggifford
PRO
0
500
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
910
Tell your own story through comics
letsgokoyo
1
1.1k
Transcript
如何準備面試 TZU 留言給我
簡報大綱 • 簡報動機 • 選擇題 • 後端 • 資料庫 •
前端
投稿的動機及這場分享想帶給讀者的是什 麼? • 自我介紹~工程師 • 希望可以讓讀者知道面試的內容 • 要考筆試
選擇題 • 也會有複選題 • 舉例說明:Java中ClassLoader中的描述,哪個是正確的? • 答案:通過Class.forName(String className),能夠加載一個類
後端:以手寫考試準備(題目) • 小於等於N的總和(使用for迴圈) • 計算1*2+ 2*3+….+(N-1)*N的總和 • 列出2-88間所有奇數的總和
小於等於N的總和(使用for迴圈) (答案1:小於等於10的總和為:55) • public class SumOfNumbers { • public static
void main(String[] args) { • int N = 10; // 將 N 設定為你想要的數字 • int totalSum = 0; // 初始化總和變數 • for (int i = 1; i <= N; i++) { • totalSum += i; // 將每個數字加到總和變數中 • } • System.out.println("小於等於 " + N + " 的總和為: " + totalSum); • } • }
計算1*2+ 2*3+….+(N-1)*N的總和 (答案2:總合為330) • 計算1*2+ 2*3+….+(N-1)*N的總和 • public class SumOfProducts
{ • public static void main(String[] args) { • int N = 10; // 將 N 設定為你想要的數字 • int totalSum = 0; // 初始化總和變數 • for (int i = 1; i < N; i++) { • totalSum += i * (i + 1); // 將每個數字的乘積加到總和變數中 • } • System.out.println("總和為: " + totalSum); • } • }
列出2-88間所有奇數的總和 (答案3:2到88間所有奇數的總和為:1935) • public class SumOfOddNumbers { • public static
void main(String[] args) { • int start = 2; // 起始數字 • int end = 88; // 結束數字 • int totalSum = 0; // 初始化總和變數 • for (int i = start; i <= end; i++) { • if (i % 2 != 0) { • totalSum += i; // 若為奇數則將數字加到總和變數中 • } • } • System.out.println("2 到 88 間所有奇數的總和為: " + totalSum); • } • }
簡答題:DAO和ENTITY是甚麼 • DAO(Data Access Object)是一個用於訪問資料庫或其他資料存 取層的介面。它提供了對資料的增、刪、改、查等操作方法,使 得業務邏輯程式能夠與資料庫進行解耦,增加了程式碼的可讀性 和可維護性。 • 在
DAO 模式中,ENTITY 是指表示資料庫中的實體或表格的 Java 物件。ENTITY 包含了資料庫中表格的結構和對應的屬性,以及與 資料庫中資料對應的方法。
簡答題: ENTITY舉例說明 • 在此範例中,User 類別代表了一個使用者 ENTITY,包含了使用者的識 別 ID、姓名和電子郵件等屬性。 • public
class User { • private int id; • private String name; • private String email; • • // 建構子、getter 和 setter 方法省略 • • // 其他相關方法 • }
簡答題: ENTITY之建構子、getter 和 setter • public String getName() { •
return name; • } • public void setName(String name) { • this.name = name; • } • public String getEmail() { • return email; • } • public void setEmail(String email) { • this.email = email; • } • } public class User { private int id; private String name; private String email; public User(int id, String name, String email) { this.id = id; this.name = name; this.email = email; } public int getId() { return id; } public void setId(int id) { this.id = id; }
簡答題:DAO舉例說明1 • UserDao 是一個介面,定義了對使用者 ENTITY 執行資料存取操作 的方法。UserDaoImpl 是 UserDao 的具體實作類別,實作了在介
面中定義的方法。 • public interface UserDao { • void createUser(User user); • User getUserById(int id); • List<User> getAllUsers(); • void updateUser(User user); • void deleteUser(int id); • }
簡答題:DAO舉例說明2 • UserDaoImpl 是 UserDao 的具體實作類別,實作了在介面 中定義的方法。 • public class
UserDaoImpl implements UserDao { • @Override • public void createUser(User user) { • // 實作創建使用者的方法 • } • @Override • public User getUserById(int id) { • // 實作獲取使用者的方法 • return null; • } • @Override • public List<User> getAllUsers() { • // 實作獲取所有使用者的方法 • return null; • } • @Override • public void updateUser(User user) { • // 實作更新使用者的方法 • } • @Override • public void deleteUser(int id) { • // 實作刪除使用者的方法 • } • }
簡答題: Bean 和 SQLMap是甚麼 • Bean 和 SQLMap 是常見的概念,用於描述資料物件和資料庫映射 的相關技術。
• Bean 是一個概念,用於表示一個普通的 Java 物件,通常用於封 裝資料和提供相關的方法。Bean 物件通常具有私有的屬性和對應 的 getter 和 setter 方法,以便對屬性進行設置和獲取。 • SQLMap 是一種用於描述資料庫操作的配置檔案或映射檔案。它 提供了資料庫表格與 Java 物件之間的映射關係,並定義了對資料 庫進行操作的 SQL 陳述式。
簡答題: Bean舉例說明 • public class User { • private int
id; • private String name; • private String email; • • // 建構子、getter 和 setter 方法省略 • • // 其他相關方法 • }
簡答題: SQLMap舉例說明 • <!-- user.xml --> • <mapper namespace="com.example.UserMapper"> •
<select id="getUserById" parameterType="int" resultType="User"> • SELECT * FROM users WHERE id = #{id} • </select> • • <insert id="createUser" parameterType="User"> • INSERT INTO users (name, email) VALUES (#{name}, #{email}) • </insert> • • • <update id="updateUser" parameterType="User"> • UPDATE users SET name = #{name}, email = #{email} WHERE id = #{id} • </update> • • <delete id="deleteUser" parameterType="int"> • DELETE FROM users WHERE id = #{id} • </delete> • </mapper>
資料庫~考題是? • SQL基礎語法:資料庫和資料表建立 • select 敍述子句 :select from • 資料操作
insert into/update /delete • Order by排序 • having篩選 • Group by分群 • 關聯式sql語法撰寫
舉例說明 Java 的 JDBC API 來執行資料庫CRUD • CRUD 是一個常用的資料庫操作詞彙,代表資料的「新增」 (Create)、「讀取」(Read)、「更新」(Update)
和「刪除」(Delete)。 這四個操作涵蓋了資料庫中最常見的基本操作。
舉例說明:新增 (Create): 使用 INSERT INTO 陳述式來插入新的資料列。 • // 使用 PreparedStatement
執行 INSERT 陳述式 • String sql = "INSERT INTO users (name, email) VALUES (?, ?)"; • try (Connection connection = DriverManager.getConnection(url, username, password); • PreparedStatement statement = connection.prepareStatement(sql)) { • statement.setString(1, "John"); • statement.setString(2, "
[email protected]
"); • int rowsInserted = statement.executeUpdate(); • if (rowsInserted > 0) { • System.out.println("新增成功"); • } • } catch (SQLException e) { • e.printStackTrace(); • }
舉例說明:讀取 (Read):使用 SELECT 陳述式 搭配 ResultSet 來檢索資料。 • // 使用
Statement 執行 SELECT 陳述式 • String sql = "SELECT * FROM users"; • try (Connection connection = DriverManager.getConnection(url, username, password); • Statement statement = connection.createStatement(); • ResultSet resultSet = statement.executeQuery(sql)) { • while (resultSet.next()) { • int id = resultSet.getInt("id"); • String name = resultSet.getString("name"); • String email = resultSet.getString("email"); • System.out.println("ID: " + id + ", Name: " + name + ", Email: " + email); • } • } catch (SQLException e) { • e.printStackTrace(); • }
舉例說明:更新 (Update):使用 UPDATE 陳 述式來修改資料列。 • // 使用 PreparedStatement 執行
UPDATE 陳述式 • String sql = "UPDATE users SET email = ? WHERE id = ?"; • try (Connection connection = DriverManager.getConnection(url, username, password); • PreparedStatement statement = connection.prepareStatement(sql)) { • statement.setString(1, "
[email protected]
"); • statement.setInt(2, 1); • int rowsUpdated = statement.executeUpdate(); • if (rowsUpdated > 0) { • System.out.println("更新成功"); • } • } catch (SQLException e) { • e.printStackTrace(); • }
舉例說明:刪除 (Delete):使用 DELETE FROM 陳述式來刪除資料列。 • // 使用 PreparedStatement 執行
DELETE 陳述式 • String sql = "DELETE FROM users WHERE id = ?"; • try (Connection connection = DriverManager.getConnection(url, username, password); • PreparedStatement statement = connection.prepareStatement(sql)) { • statement.setInt(1, 1); • int rowsDeleted = statement.executeUpdate(); • if (rowsDeleted > 0) { • System.out.println("刪除成功"); • } • } catch (SQLException e) { • e.printStackTrace(); • }
資料庫都是用有關聯的~ • 關聯式資料庫(Relational Database)是一種以表格 (Table)形式組織和儲存資料 的資料庫。在關聯式資料庫中, 資料被組織成多個相互關聯的 表格,每個表格由一個或多個 欄位(Column)組成,代表不 同的屬性,並且使用主鍵
(Primary Key)和外鍵 (Foreign Key)建立表格之間 的關聯。 • 關聯式資料庫
資料型態: • 數字欄位(int):用於儲存整數值,範圍通常根據資料庫系統而 有所不同。 • 文字欄位(varchar(30)):用於儲存可變長度的字串,括號內的 數字表示欄位的最大長度。 • 精準小數(decimal(9,2)):用於儲存具有固定小數位數的數值, 括號內的數字分別表示總位數和小數位數。
• 時間欄位(datetime):用於儲存日期和時間的值,通常以特定 的格式表示(例如 YYYY-MM-DD HH:MM:SS)。
簡答題:這段SQL語法的意思? • Select sign_code,fu_name from common_flow_header where fu_name='價格核決作業’ • 一個名為
common_flow_header 的資料表,其中包含 sign_code 和 fu_name 兩個欄位,你想要查詢 fu_name 為 "價格核決作業" 的資 料列中的 sign_code 和 fu_name 欄位的值。 • 這個查詢將從 common_flow_header 表格中檢索符合條件的資料 列,並選擇 sign_code 和 fu_name 欄位的值。條件是 fu_name 欄 位等於 "價格核決作業"。執行這個查詢後,你將得到符合條件的 資料列的 sign_code 和 fu_name 值。
Order by排序 • ASC升序 • DESC降序
NULL 空值 • SELECT * FROM 表名 WHERE 欄位名 IS
NULL; • SELECT * FROM 表名 WHERE 欄位名 IS NOT NULL; • 第一個查詢將返回表中該欄位值為 NULL 的記錄,而第二個查詢 將返回表中該欄位值不為 NULL 的記錄。 • 在設計資料庫結構時,您可以選擇是否允許欄位為 NULL。根據需 要和業務邏輯,您可以將某些欄位設置為必填(NOT NULL),或 允許其為可選的(NULL)。
having篩選與Group by分群 • SELECT Category, COUNT(*) as Total • FROM
Products • GROUP BY Category • HAVING COUNT(*) > 5; • 這個查詢將返回 Products 表中按照類別(Category)分組的記錄 數目大於 5 的結果。HAVING 子句篩選掉了分組後的結果集中那 些不符合條件的組。 • HAVING 子句僅在使用聚合函數(如 COUNT、SUM、AVG 等)並 進行分組操作時使用。
再練習一下資料庫 • CREATE TABLE t3 (c1 INT, c2 VARCHAR(10)); •
建立表格 t3: • ALTER TABLE t3 ADD c3 INT; • 修改表格 t3,新增欄位 c3: • SELECT * FROM t3; • 查詢表格 t3 中的所有資料: • INSERT INTO t3 (c1, c2, c3) VALUES (1, 'A', 100); • 成功插入新的記錄到表格 t3。
前端 • 作品集: https://jzs2home.github.io/blog/admin/blogs.html?fbclid=IwAR0z5n u5rFxHnVKqjtjAskFp4EJQVbPAROPwSKjCCEdpd5YWYXP_m_I2Z6I
使用Chrome看網頁
使用開發者工具
可以看到前端秘密~
可以看到前端語法~
前端開發三個主要的技術:HTML、CSS 和 JavaScript。 • HTML 定義了網頁結構和內容 • CSS 負責網頁的外觀和佈局 •
而 JavaScript 則為網頁添加互動性和動態效果。
留言板: • http://jzs2home.byethost15.com/index.php?i=3&fbclid=IwAR30I3qlb kBAbp0MEE_JtIldTH1KdZQdXjT-msg35saXVHUY_7-jxXOsZdo