为什么mysql中varchar字段和int字段对比是否相等不会出错?

a.b_ids = b.id
前面一个字段是varchar类型的,保存的是用逗号隔开的数字,型如1,2,3
后面一个字段是int类型的,两个字段对比是否相等时没有报错,好像取了前一个字段的第一个值做比较

1个回答

因为字符串类型的变量与数字类型的变量相比较的时候,会从左到右依次取字符串中的数字出来,直到第一个不是数字的字符为止。
比如'12abc3'这个字符串,它和数字类型的变量去作比较的时候,就等价于12。
图片说明
比如这个,输出结果是int(-1)

qq_39822451
Marttin2 真腻害
大约一年之前 回复
Eden_M516
凌晨四点钟的Eden 回复MoonlightRains: 这样啊,谢谢。所以在mysql中也是遵循这种情况?类似于js?
3 年多之前 回复
MoonlightBlast
NewWorldKing_ 回复凌晨四点钟的Eden: 要看你用的编程语言的强弱类型。比如java是强类型语言,对变量的数据类型有严格限制。你定义个int a = 5,再定义a = abc,这就不行了,不合语法规则会直接报错。而弱类型语言则不会对变量类型严格限制, 比如在JavaScript中定义 var a = 5,a是整形; 但你可以接着写a = "abc", a会直接变成字符串类型。
3 年多之前 回复
Eden_M516
凌晨四点钟的Eden 这是在特定语言中这样么,我试了试java好像不可以
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
MySQL varchar与数字比较 进行查询的问题

今天写sql的时候遇到一个问题,我在where语句里面写的是a.poruid = 0,这个字段是varchar类型的,结果返回的是全集,改为a.poruid = "0"的时候查出来的猜我我想要的结果,很奇怪,有数据库方面的大神能解答一下吗?varchar类型与数字比较的机制吗?我主要是想知道为什么不加引号的时候返回的是全集,,,

数据表中可不可以全部是varchar类型,有的字段值是数字

1.数据表中可不可以全部是varchar类型,有的字段值是数字,好处与坏处 2.查询数据库返回的值是不是必须用相同类型存放或是只要名字相同就

使用mysql中的enum字段选择行

<div class="post-text" itemprop="text"> <p>I am facing an abnormal issue with the enum field(UserStatus) of my table(userinfo). The table structure is as follows:</p> <pre><code>Field Type Default ------------------------------------------ Id int(11) (NULL) FirstName varchar(50) (NULL) LastName varchar(50) (NULL) .... ... ... .... ... ... UserStatus enum('0','1') (NULL) </code></pre> <p>Here I have rows with the UserStatus values as NULL, 0 and 1. But When I am trying to select rows on the basis of the UserStatus field like:</p> <pre><code>SELECT * FROM userinfo WHERE UserStatus&lt;&gt;'1' </code></pre> <p>Its not working and resulting in an empty resultset.</p> <p>Thanks in advance.</p> </div>

求问一个mysql的存储过程,求大神解答,谢谢

mysql数据库中,有一个表 表中有两个字段 id 和pid 如同这种 id pid 1 2 2 3 3 4 省略号 800 801 这种,就是我输入一个id 为800的 如何能够找出他的所有上级 上级的意思就是我id=800的 和上面的pid 相等,并且一层层的找上去这种。 请问一下 各位大神有人会吗? 我写不出来了。 拜求大神解答! 这是我写的: ``` DELIMITER // CREATE PROCEDURE test(IN id INT,OUT mainid INT ) BEGIN SELECT @pidNum= (SELECT pid FROM admin WHERE admin.pid=3 ) WHILE ( @pidNum != -1 ) BEGIN SELECT id = (SELECT id FROM admin WHERE admin.id=@pidNum ) END SET mainid=@id END DELIMITER ; ``` 不过是错的

SQL-JOIN错误=>多个表中的相同列名

<div class="post-text" itemprop="text"> <p>I have some trouble trying to join a couple of tables for a time-booking system.</p> <p>The database look like this:</p> <h2><strong>Database tables:</strong></h2> <p>tbl_events</p> <pre><code>- int_eventID (INT) - int_serviceID (INT) - date_eventDueDate (DATETIME) - date_eventCreationDate (DATETIME) - int_userID (INT) - int_customerID (INT) - int_eventOnlineBooked (INT) </code></pre> <p>tbl_customers</p> <pre><code>- int_customerID (INT) &gt;&gt;&gt; - int_userID (INT) &lt;= this one gives me headache &lt;&lt; - str_customerFirstName (VARCHAR) - str_customerLastName (VARCHAR) - str_customerEmail (VARCHAR) - str_customerPassword (VARCHAR) - str_customerCellPhone (VARCHAR) - str_customerHomePhone (VARCHAR) - str_customerAddress (VARCHAR) </code></pre> <p>tbl_services</p> <pre><code>int_serviceID (INT) str_serviceName (VARCHAR) str_serviceDescription (VARCHAR) int_servicePrice (INT) int_serviceTimescale (TIME) </code></pre> <p>tbl_users</p> <pre><code>int_userID (INT) str_userFirstName (VARCHAR) str_userLastName (VARCHAR) str_userEmail (VARCHAR) str_userPassword (VARCHAR) str_userCellPhone (VARCHAR) </code></pre> <hr> <p>I've got everything to work as expected by the SQL-query (see below). It gives me all events for a specific "user" during a specific week.</p> <h2><strong>SQL query:</strong></h2> <pre><code>SELECT int_customerID as customerID, int_serviceID as serviceID, int_eventID as eventID, date_eventDueDate as eventDueDate, date_eventCreationDate as eventCreationDate, int_eventOnlineBooked as eventOnlineBooked, str_serviceName as serviceName, int_serviceTimescale as serviceTimescale, str_customerFirstName as customerFirstName, str_customerLastName as customerLastName, str_customerCellPhone as customerCellPhone, str_customerHomePhone as customerHomePhone FROM tbl_events JOIN tbl_services USING (int_serviceID) JOIN tbl_customers USING (int_customerID) WHERE int_userID = 1 AND YEARWEEK(date_eventDueDate,1) = 201219 </code></pre> <hr> <p>The problem is, I didn't had a column in the tbl_customers table that specified which user that customer belongs to. When I added "int_userID" to tbl_customers the SQL-stopped working and gave me the error message:</p> <pre><code>&lt;b&gt;Warning&lt;/b&gt;: mysql_num_rows() expects parameter 1 to be resource, boolean given in &lt;b&gt;/Library/WebServer/Documents/calendar/api/calender_getWeekGetEvents.php&lt;/b&gt; on line &lt;b&gt;46&lt;/b&gt;&lt;br /&gt; </code></pre> <p>Line 46:</p> <pre><code>if(mysql_num_rows($result)) { while($event = mysql_fetch_assoc($result)) { $events[] = $event; } } </code></pre> <p>Any ideas? :)</p> <p>Thanks / L</p> </div>

获取字段和group_concat的计数

<div class="post-text" itemprop="text"> <p>table structure is as follows -- Table structure for table <code>category</code></p> <pre><code>CREATE TABLE `category` ( `cat_id` int(10) NOT NULL auto_increment, `heading` varchar(255) NOT NULL, PRIMARY KEY (`cat_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `category` (`cat_id`, `heading`) VALUES (1, 'Fashion'), (2, 'Kids'); -- -------------------------------------------------------- -- Table structure for table `shop` CREATE TABLE `shop` ( `store_id` int(10) NOT NULL auto_increment, `shop_name` varchar(255) NOT NULL, `cat_id` int(10) NOT NULL, `subcat_id` int(10) NOT NULL, PRIMARY KEY (`store_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; INSERT INTO `shop` (`store_id`, `shop_name`, `cat_id`, `subcat_id`) VALUES (1, 'Test Store', 1, 1), (2, 'Test Store 1', 1, 1), (3, 'Another Store', 1, 3); -- -------------------------------------------------------- -- Table structure for table `subcategory` CREATE TABLE `subcategory` ( `subcat_id` int(10) NOT NULL auto_increment, `cat_id` int(10) NOT NULL, `heading` varchar(255) NOT NULL, PRIMARY KEY (`subcat_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; INSERT INTO `subcategory` (`subcat_id`, `cat_id`, `heading`) VALUES (1, 1, 'Women'), (2, 1, 'General'), (3, 1, 'Men'), (4, 2, 'Children'); </code></pre> <p>if i use the below query i get the following output</p> <pre><code>SELECT `category`.`heading` AS `category` , `subcategory`.`heading` AS `subcategory` , COUNT(`shop`.`subcat_id`) AS cnt FROM `test`.`shop` INNER JOIN `test`.`subcategory` ON (`shop`.`subcat_id` = `subcategory`.`subcat_id`) INNER JOIN `test`.`category` ON (`shop`.`cat_id` = `category`.`cat_id`) GROUP BY `shop`.`subcat_id` HAVING (COUNT(`shop`.`subcat_id`) !=''); </code></pre> <p><kbd>category</kbd><kbd>subcategory</kbd><kbd>cnt</kbd><br> <kbd>Fashion</kbd><kbd>Women</kbd><kbd>2</kbd><br> <kbd>Fashion</kbd><kbd>Men</kbd><kbd>1</kbd><br> </p> <p>but i want to group concat the subcategory like below</p> <p><kbd>category</kbd><kbd>subcategory</kbd><br> <kbd>Fashion</kbd><kbd>Women,2|Men,1</kbd><br> </p> </div>

请教关于MySQL新增数据,不存在则新增,存在则更新的问题

问题描述: 一张表,id为主键,现在在数据库中插入数据,如果存在firstName、lastName相同的数据,则更新count,不存在这插入数据。 例如:已有数据中,已存在 firstName 为 Jack,lastName 为 Li 的数据,则原有数据不新增,只修改count。 我尝试过使用ON DUPLICATE KEY UPDATE函数,但是我发现这个函数貌似只能根据插入的数据中第一个字段做判断。 请高手们多多指点。 ##建表 CREATE TABLE `test` ( `id` int(11) NOT NULL AUTO_INCREMENT, `firstName` varchar(20) DEFAULT NULL, `lasetName` varchar(20) DEFAULT NULL, `job` varchar(255) DEFAULT NULL, `phone` varchar(255) DEFAULT NULL, `count` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; ``` ``` ## 插入数据: INSERT INTO `test` (`id`, `firstName`, `lasetName`, `job`, `phone`, `count`) VALUES ('1', 'Jack', 'Chen', '演员', '110', 100); INSERT INTO `test` (`id`, `firstName`, `lasetName`, `job`, `phone`, `count`) VALUES ('2', 'Jack', 'Li', '演员', '110', 200); ``` ``` ##删除表: DROP TABLE test; ``` ```

MySQL 向数据库中更新数据,会影响全文索引的查询速度吗?

有一张表大概是这样: ``` CREATE TABLE `t` ( `id1` INT UNSIGNED, `id2` INT UNSIGNED, `name` VARCHAR(255), `num` INT UNSIGNED, ..., PRIMARY KEY (`id1`, `id2`) ) ``` 表是联合主键(不过应该不是这里的问题吧?) 在name字段建立了全文索引,num字段建立了普通的索引 有这两个查询: ``` SELECT id1, id2 FROM t WHERE MATCH(name) AGAINST('abc'); SELECT id1, id2 FROM t WHERE num=1000; ``` 正常的时候速度还算可以接受。 但是当开启另一个程序,在程序中以多线程向表中更新数据时(INSERT INTO ... ON DUPLICATE KEY UPDATE ...),刚才的两个查询就会变得巨慢(将近10倍甚至更多);num的查询比name的好一些,但是同样慢了很多。 请问这个问题是咋来的,大概应该如何解决?

mysql查询数据使用 limit 999999和 未使用limit 结果不同 limit的使用方法?

需求: 查询用户房间type为2的房间战绩排行榜 根据 主条件killNum做降序, 次条件scoreNum做降序,一个用户只能出现一次取其最高的数据 在同样环境,数据相同的情况下,查询出来的数据不同 纠结了许久 答案数据返回正确 但是我心里摸不着底SQL感觉还需要优化 也喜欢CSDN的大佬们有时间能看一看 有limit 正常: ![图片说明](https://img-ask.csdn.net/upload/201811/27/1543319092_471669.png) 无limit 不正常: ![图片说明](https://img-ask.csdn.net/upload/201811/27/1543319161_377684.png) 表结构如下: 用户表: CREATE TABLE `ss_account` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 125 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 房间id表: CREATE TABLE `ss_room_inc_id` ( `id` int(11) NOT NULL AUTO_INCREMENT , `type` tinyint(1) NOT NULL , `create_time` int(10) NOT NULL DEFAULT 0 , PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2065 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 房间战绩表: CREATE TABLE `ss_game_record` ( `id` int(11) NOT NULL AUTO_INCREMENT , `account_id` int(11) NOT NULL, `room_id` int(11) NOT NULL , `score_num` int(11) NOT NULL, `kill_num` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, ) ENGINE = InnoDB AUTO_INCREMENT = 156 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; 表数据: INSERT INTO `ss_account` VALUES (120, 'Dean'); INSERT INTO `ss_account` VALUES (121, ''); INSERT INTO `ss_account` VALUES (122, '丑娃儿'); INSERT INTO `ss_account` VALUES (123, '一万年'); INSERT INTO `ss_account` VALUES (124, '单打独斗'); INSERT INTO `ss_game_record` VALUES (2, 120, 1905, 120, 2); INSERT INTO `ss_game_record` VALUES (3, 121, 1906, 80, 1); INSERT INTO `ss_game_record` VALUES (4, 122, 1907, 70, 5); INSERT INTO `ss_game_record` VALUES (5, 122, 1908, 80, 5); INSERT INTO `ss_game_record` VALUES (6, 120, 1909, 100, 0); INSERT INTO `ss_game_record` VALUES (7, 120, 1910, 70, 0); INSERT INTO `ss_game_record` VALUES (8, 120, 1911, 45, 1); INSERT INTO `ss_game_record` VALUES (9, 120, 1912, 195, 1); INSERT INTO `ss_game_record` VALUES (10, 122, 1913, 110, 4); INSERT INTO `ss_game_record` VALUES (11, 120, 1914, 75, 1); INSERT INTO `ss_game_record` VALUES (12, 120, 1915, 105, 0); INSERT INTO `ss_game_record` VALUES (13, 120, 1916, 140, 1); INSERT INTO `ss_game_record` VALUES (14, 120, 1917, 180, 1); INSERT INTO `ss_game_record` VALUES (15, 120, 1918, 495, 0); INSERT INTO `ss_game_record` VALUES (16, 120, 1919, 170, 1); INSERT INTO `ss_game_record` VALUES (17, 120, 1920, 205, 0); INSERT INTO `ss_game_record` VALUES (18, 120, 1921, 435, 0); INSERT INTO `ss_game_record` VALUES (19, 120, 1922, 95, 1); INSERT INTO `ss_game_record` VALUES (20, 120, 1923, 105, 1); INSERT INTO `ss_game_record` VALUES (21, 122, 1924, 230, 0); INSERT INTO `ss_game_record` VALUES (22, 122, 1925, 145, 0); INSERT INTO `ss_game_record` VALUES (23, 122, 1926, 55, 0); INSERT INTO `ss_game_record` VALUES (24, 122, 1927, 325, 0); INSERT INTO `ss_game_record` VALUES (25, 122, 1928, 235, 0); INSERT INTO `ss_game_record` VALUES (26, 122, 1930, 45, 0); INSERT INTO `ss_game_record` VALUES (27, 123, 1929, 70, 0); INSERT INTO `ss_game_record` VALUES (28, 122, 1931, 25, 0); INSERT INTO `ss_game_record` VALUES (29, 122, 1932, 25, 0); INSERT INTO `ss_game_record` VALUES (30, 122, 1933, 35, 0); INSERT INTO `ss_game_record` VALUES (31, 122, 1934, 25, 0); INSERT INTO `ss_game_record` VALUES (32, 122, 1935, 25, 0); INSERT INTO `ss_game_record` VALUES (33, 122, 1936, 55, 0); INSERT INTO `ss_game_record` VALUES (34, 122, 1937, 25, 0); INSERT INTO `ss_game_record` VALUES (35, 122, 1938, 115, 0); INSERT INTO `ss_game_record` VALUES (36, 122, 1939, 135, 0); INSERT INTO `ss_game_record` VALUES (37, 122, 1940, 105, 0); INSERT INTO `ss_game_record` VALUES (38, 122, 1941, 95, 0); INSERT INTO `ss_game_record` VALUES (39, 120, 1942, 380, 0); INSERT INTO `ss_game_record` VALUES (40, 122, 1943, 45, 0); INSERT INTO `ss_game_record` VALUES (41, 120, 1945, 2640, 3); INSERT INTO `ss_game_record` VALUES (42, 122, 1944, 35, 0); INSERT INTO `ss_game_record` VALUES (43, 122, 1946, 25, 0); INSERT INTO `ss_game_record` VALUES (44, 122, 1947, 35, 0); INSERT INTO `ss_game_record` VALUES (45, 122, 1948, 30, 0); INSERT INTO `ss_game_record` VALUES (46, 122, 1950, 45, 0); INSERT INTO `ss_game_record` VALUES (47, 122, 1951, 45, 0); INSERT INTO `ss_game_record` VALUES (48, 122, 1952, 35, 0); INSERT INTO `ss_game_record` VALUES (49, 122, 1954, 35, 0); INSERT INTO `ss_game_record` VALUES (50, 122, 1953, 100, 0); INSERT INTO `ss_game_record` VALUES (51, 122, 1956, 100, 0); INSERT INTO `ss_game_record` VALUES (52, 122, 1957, 25, 0); INSERT INTO `ss_game_record` VALUES (53, 122, 1958, 80, 0); INSERT INTO `ss_game_record` VALUES (54, 122, 1955, 30, 0); INSERT INTO `ss_game_record` VALUES (55, 122, 1959, 85, 0); INSERT INTO `ss_game_record` VALUES (56, 122, 1960, 45, 0); INSERT INTO `ss_game_record` VALUES (57, 122, 1961, 45, 0); INSERT INTO `ss_game_record` VALUES (58, 122, 1962, 30, 0); INSERT INTO `ss_game_record` VALUES (59, 122, 1963, 65, 0); INSERT INTO `ss_game_record` VALUES (60, 122, 1964, 75, 0); INSERT INTO `ss_game_record` VALUES (61, 122, 1967, 25, 0); INSERT INTO `ss_game_record` VALUES (62, 122, 1966, 110, 0); INSERT INTO `ss_game_record` VALUES (63, 122, 1968, 25, 0); INSERT INTO `ss_game_record` VALUES (64, 122, 1969, 55, 0); INSERT INTO `ss_game_record` VALUES (65, 122, 1970, 25, 0); INSERT INTO `ss_game_record` VALUES (66, 122, 1974, 45, 0); INSERT INTO `ss_game_record` VALUES (67, 122, 1973, 80, 0); INSERT INTO `ss_game_record` VALUES (68, 122, 1972, 90, 0); INSERT INTO `ss_game_record` VALUES (69, 122, 1971, 110, 0); INSERT INTO `ss_game_record` VALUES (70, 122, 1975, 25, 0); INSERT INTO `ss_game_record` VALUES (71, 122, 1977, 25, 0); INSERT INTO `ss_game_record` VALUES (72, 122, 1976, 100, 0); INSERT INTO `ss_game_record` VALUES (73, 122, 1978, 35, 0); INSERT INTO `ss_game_record` VALUES (74, 122, 1979, 45, 0); INSERT INTO `ss_game_record` VALUES (75, 122, 1980, 40, 0); INSERT INTO `ss_game_record` VALUES (76, 122, 1983, 25, 0); INSERT INTO `ss_game_record` VALUES (77, 122, 1984, 25, 0); INSERT INTO `ss_game_record` VALUES (78, 122, 1981, 180, 0); INSERT INTO `ss_game_record` VALUES (79, 122, 1985, 25, 0); INSERT INTO `ss_game_record` VALUES (80, 122, 1982, 50, 0); INSERT INTO `ss_game_record` VALUES (81, 122, 1989, 25, 0); INSERT INTO `ss_game_record` VALUES (82, 122, 1986, 85, 0); INSERT INTO `ss_game_record` VALUES (83, 122, 1990, 80, 0); INSERT INTO `ss_game_record` VALUES (84, 122, 1987, 165, 0); INSERT INTO `ss_game_record` VALUES (85, 122, 1988, 45, 0); INSERT INTO `ss_game_record` VALUES (86, 122, 1991, 65, 0); INSERT INTO `ss_game_record` VALUES (87, 122, 1992, 40, 0); INSERT INTO `ss_game_record` VALUES (88, 122, 1993, 80, 0); INSERT INTO `ss_game_record` VALUES (89, 122, 1994, 650, 0); INSERT INTO `ss_game_record` VALUES (90, 122, 1995, 140, 0); INSERT INTO `ss_game_record` VALUES (91, 122, 1997, 190, 0); INSERT INTO `ss_game_record` VALUES (92, 120, 2001, 0, 0); INSERT INTO `ss_game_record` VALUES (93, 122, 1999, 75, 0); INSERT INTO `ss_game_record` VALUES (94, 120, 2002, 585, 0); INSERT INTO `ss_game_record` VALUES (95, 120, 2005, 115, 0); INSERT INTO `ss_game_record` VALUES (96, 122, 2003, 125, 0); INSERT INTO `ss_game_record` VALUES (97, 122, 2004, 55, 0); INSERT INTO `ss_game_record` VALUES (98, 122, 2000, 35, 0); INSERT INTO `ss_game_record` VALUES (99, 122, 2006, 90, 0); INSERT INTO `ss_game_record` VALUES (100, 120, 2008, 880, 2); INSERT INTO `ss_game_record` VALUES (101, 120, 2011, 380, 0); INSERT INTO `ss_game_record` VALUES (102, 122, 2009, 180, 0); INSERT INTO `ss_game_record` VALUES (103, 120, 2012, 730, 1); INSERT INTO `ss_game_record` VALUES (104, 120, 2013, 0, 0); INSERT INTO `ss_game_record` VALUES (105, 122, 2007, 310, 0); INSERT INTO `ss_game_record` VALUES (106, 120, 2014, 635, 0); INSERT INTO `ss_game_record` VALUES (107, 122, 2015, 55, 0); INSERT INTO `ss_game_record` VALUES (108, 122, 2016, 75, 0); INSERT INTO `ss_game_record` VALUES (109, 122, 2017, 240, 0); INSERT INTO `ss_game_record` VALUES (110, 122, 2018, 25, 0); INSERT INTO `ss_game_record` VALUES (111, 122, 2019, 140, 0); INSERT INTO `ss_game_record` VALUES (112, 122, 2020, 35, 0); INSERT INTO `ss_game_record` VALUES (113, 122, 2021, 25, 0); INSERT INTO `ss_game_record` VALUES (114, 122, 2022, 40, 0); INSERT INTO `ss_game_record` VALUES (115, 122, 2023, 25, 0); INSERT INTO `ss_game_record` VALUES (116, 122, 2024, 35, 0); INSERT INTO `ss_game_record` VALUES (117, 122, 2025, 25, 0); INSERT INTO `ss_game_record` VALUES (118, 122, 2026, 60, 0); INSERT INTO `ss_game_record` VALUES (119, 122, 2027, 55, 0); INSERT INTO `ss_game_record` VALUES (120, 122, 2028, 25, 0); INSERT INTO `ss_game_record` VALUES (121, 122, 2029, 25, 0); INSERT INTO `ss_game_record` VALUES (122, 122, 2030, 25, 0); INSERT INTO `ss_game_record` VALUES (123, 122, 2031, 105, 0); INSERT INTO `ss_game_record` VALUES (124, 122, 2032, 50, 0); INSERT INTO `ss_game_record` VALUES (125, 122, 2033, 25, 0); INSERT INTO `ss_game_record` VALUES (126, 122, 2034, 25, 0); INSERT INTO `ss_game_record` VALUES (127, 122, 2035, 25, 0); INSERT INTO `ss_game_record` VALUES (128, 122, 2036, 45, 0); INSERT INTO `ss_game_record` VALUES (129, 122, 2037, 25, 0); INSERT INTO `ss_game_record` VALUES (130, 122, 2038, 425, 0); INSERT INTO `ss_game_record` VALUES (131, 122, 2039, 50, 0); INSERT INTO `ss_game_record` VALUES (132, 122, 2040, 65, 0); INSERT INTO `ss_game_record` VALUES (133, 122, 2041, 195, 0); INSERT INTO `ss_game_record` VALUES (134, 122, 2042, 250, 0); INSERT INTO `ss_game_record` VALUES (135, 122, 2043, 25, 0); INSERT INTO `ss_game_record` VALUES (136, 122, 2044, 100, 0); INSERT INTO `ss_game_record` VALUES (137, 122, 2045, 25, 0); INSERT INTO `ss_game_record` VALUES (138, 122, 2046, 70, 0); INSERT INTO `ss_game_record` VALUES (139, 122, 2047, 30, 0); INSERT INTO `ss_game_record` VALUES (140, 122, 2048, 110, 0); INSERT INTO `ss_game_record` VALUES (141, 122, 2050, 25, 0); INSERT INTO `ss_game_record` VALUES (142, 122, 2049, 330, 0); INSERT INTO `ss_game_record` VALUES (143, 122, 2051, 45, 0); INSERT INTO `ss_game_record` VALUES (144, 122, 2052, 35, 0); INSERT INTO `ss_game_record` VALUES (145, 122, 2053, 25, 0); INSERT INTO `ss_game_record` VALUES (146, 122, 2054, 110, 0); INSERT INTO `ss_game_record` VALUES (147, 122, 2055, 230, 0); INSERT INTO `ss_game_record` VALUES (148, 122, 2056, 105, 0); INSERT INTO `ss_game_record` VALUES (149, 122, 2057, 175, 0); INSERT INTO `ss_game_record` VALUES (150, 122, 2058, 585, 0); INSERT INTO `ss_game_record` VALUES (151, 122, 2059, 60, 0); INSERT INTO `ss_game_record` VALUES (152, 122, 2060, 160, 0); INSERT INTO `ss_game_record` VALUES (153, 122, 2061, 170, 0); INSERT INTO `ss_game_record` VALUES (154, 122, 2062, 255, 0); INSERT INTO `ss_game_record` VALUES (155, 122, 2063, 250, 0); INSERT INTO `ss_room_inc_id` VALUES (1905, 2, 1543304140); INSERT INTO `ss_room_inc_id` VALUES (1906, 2, 1543304154); INSERT INTO `ss_room_inc_id` VALUES (1907, 2, 1543304140); INSERT INTO `ss_room_inc_id` VALUES (1908, 2, 1143304770); INSERT INTO `ss_room_inc_id` VALUES (1909, 1, 1543304770); INSERT INTO `ss_room_inc_id` VALUES (1910, 1, 1543304770); INSERT INTO `ss_room_inc_id` VALUES (1911, 1, 1543304862); INSERT INTO `ss_room_inc_id` VALUES (1912, 2, 1543304862); INSERT INTO `ss_room_inc_id` VALUES (1913, 2, 1543304862); INSERT INTO `ss_room_inc_id` VALUES (1914, 1, 1543305379); INSERT INTO `ss_room_inc_id` VALUES (1915, 1, 1543305379); INSERT INTO `ss_room_inc_id` VALUES (1916, 1, 1543305491); INSERT INTO `ss_room_inc_id` VALUES (1917, 1, 1543305491); INSERT INTO `ss_room_inc_id` VALUES (1918, 1, 1543306739); INSERT INTO `ss_room_inc_id` VALUES (1919, 1, 1543306740); INSERT INTO `ss_room_inc_id` VALUES (1920, 2, 1543306872); INSERT INTO `ss_room_inc_id` VALUES (1921, 2, 1543306930); INSERT INTO `ss_room_inc_id` VALUES (1922, 1, 1543306934); INSERT INTO `ss_room_inc_id` VALUES (1923, 1, 1543306934); INSERT INTO `ss_room_inc_id` VALUES (1924, 1, 1543308579); INSERT INTO `ss_room_inc_id` VALUES (1925, 1, 1543308579); INSERT INTO `ss_room_inc_id` VALUES (1926, 1, 1543309072); INSERT INTO `ss_room_inc_id` VALUES (1927, 1, 1543309072); INSERT INTO `ss_room_inc_id` VALUES (1928, 1, 1543309199); INSERT INTO `ss_room_inc_id` VALUES (1929, 1, 1543309199); INSERT INTO `ss_room_inc_id` VALUES (1930, 1, 1543309277); INSERT INTO `ss_room_inc_id` VALUES (1931, 1, 1543309277); INSERT INTO `ss_room_inc_id` VALUES (1932, 1, 1543309626); INSERT INTO `ss_room_inc_id` VALUES (1933, 1, 1543309626); INSERT INTO `ss_room_inc_id` VALUES (1934, 1, 1543309635); INSERT INTO `ss_room_inc_id` VALUES (1935, 1, 1543309636); INSERT INTO `ss_room_inc_id` VALUES (1936, 1, 1543309685); INSERT INTO `ss_room_inc_id` VALUES (1937, 1, 1543309685); INSERT INTO `ss_room_inc_id` VALUES (1938, 1, 1543309722); INSERT INTO `ss_room_inc_id` VALUES (1939, 1, 1543309722); INSERT INTO `ss_room_inc_id` VALUES (1940, 1, 1543309770); INSERT INTO `ss_room_inc_id` VALUES (1941, 1, 1543309770); INSERT INTO `ss_room_inc_id` VALUES (1942, 2, 1543309797); INSERT INTO `ss_room_inc_id` VALUES (1943, 1, 1543309889); INSERT INTO `ss_room_inc_id` VALUES (1944, 1, 1243309889); INSERT INTO `ss_room_inc_id` VALUES (1945, 2, 1243310030); INSERT INTO `ss_room_inc_id` VALUES (1946, 1, 1543310151); INSERT INTO `ss_room_inc_id` VALUES (1947, 1, 1543310151); INSERT INTO `ss_room_inc_id` VALUES (1948, 1, 1543310160); INSERT INTO `ss_room_inc_id` VALUES (1949, 1, 1543310160); INSERT INTO `ss_room_inc_id` VALUES (1950, 1, 1543310233); INSERT INTO `ss_room_inc_id` VALUES (1951, 1, 1543310233); INSERT INTO `ss_room_inc_id` VALUES (1952, 1, 1543310244); INSERT INTO `ss_room_inc_id` VALUES (1953, 1, 1543310244); INSERT INTO `ss_room_inc_id` VALUES (1954, 1, 1543310255); INSERT INTO `ss_room_inc_id` VALUES (1955, 1, 1543310255); INSERT INTO `ss_room_inc_id` VALUES (1956, 1, 1543310300); INSERT INTO `ss_room_inc_id` VALUES (1957, 1, 1543310300); INSERT INTO `ss_room_inc_id` VALUES (1958, 1, 1543310462); INSERT INTO `ss_room_inc_id` VALUES (1959, 1, 1543310462); INSERT INTO `ss_room_inc_id` VALUES (1960, 1, 1543310487); INSERT INTO `ss_room_inc_id` VALUES (1961, 1, 1543310487); INSERT INTO `ss_room_inc_id` VALUES (1962, 1, 1543310496); INSERT INTO `ss_room_inc_id` VALUES (1963, 1, 1543310496); INSERT INTO `ss_room_inc_id` VALUES (1964, 1, 1543310561); INSERT INTO `ss_room_inc_id` VALUES (1965, 1, 1543310561); INSERT INTO `ss_room_inc_id` VALUES (1966, 1, 1543310902); INSERT INTO `ss_room_inc_id` VALUES (1967, 1, 1543310902); INSERT INTO `ss_room_inc_id` VALUES (1968, 1, 1543310946); INSERT INTO `ss_room_inc_id` VALUES (1969, 1, 1543310946); INSERT INTO `ss_room_inc_id` VALUES (1970, 1, 1543310953); INSERT INTO `ss_room_inc_id` VALUES (1971, 1, 1543310953); INSERT INTO `ss_room_inc_id` VALUES (1972, 1, 1543310961); INSERT INTO `ss_room_inc_id` VALUES (1973, 1, 1543310961); INSERT INTO `ss_room_inc_id` VALUES (1974, 1, 1543310967); INSERT INTO `ss_room_inc_id` VALUES (1975, 1, 1543310991); INSERT INTO `ss_room_inc_id` VALUES (1976, 1, 1543310991); INSERT INTO `ss_room_inc_id` VALUES (1977, 1, 1543311000); INSERT INTO `ss_room_inc_id` VALUES (1978, 1, 1543311000); INSERT INTO `ss_room_inc_id` VALUES (1979, 1, 1543311011); INSERT INTO `ss_room_inc_id` VALUES (1980, 1, 1543311011); INSERT INTO `ss_room_inc_id` VALUES (1981, 1, 1543311012); INSERT INTO `ss_room_inc_id` VALUES (1982, 1, 1543311012); INSERT INTO `ss_room_inc_id` VALUES (1983, 1, 1543311020); INSERT INTO `ss_room_inc_id` VALUES (1984, 1, 1543311020); INSERT INTO `ss_room_inc_id` VALUES (1985, 1, 1543311031); INSERT INTO `ss_room_inc_id` VALUES (1986, 1, 1543311031); INSERT INTO `ss_room_inc_id` VALUES (1987, 1, 1543311034); INSERT INTO `ss_room_inc_id` VALUES (1988, 1, 1543311034); INSERT INTO `ss_room_inc_id` VALUES (1989, 1, 1543311038); INSERT INTO `ss_room_inc_id` VALUES (1990, 1, 1543311038); INSERT INTO `ss_room_inc_id` VALUES (1991, 1, 1543311067); INSERT INTO `ss_room_inc_id` VALUES (1992, 1, 1543311067); INSERT INTO `ss_room_inc_id` VALUES (1993, 1, 1543311091); INSERT INTO `ss_room_inc_id` VALUES (1994, 1, 1543311091); INSERT INTO `ss_room_inc_id` VALUES (1995, 1, 1543311227); INSERT INTO `ss_room_inc_id` VALUES (1996, 1, 1543311227); INSERT INTO `ss_room_inc_id` VALUES (1997, 1, 1543311283); INSERT INTO `ss_room_inc_id` VALUES (1998, 1, 1543311283); INSERT INTO `ss_room_inc_id` VALUES (1999, 1, 1543311339); INSERT INTO `ss_room_inc_id` VALUES (2000, 1, 1543311339); INSERT INTO `ss_room_inc_id` VALUES (2001, 2, 1543311342); INSERT INTO `ss_room_inc_id` VALUES (2002, 2, 1543311400); INSERT INTO `ss_room_inc_id` VALUES (2003, 1, 1543311400); INSERT INTO `ss_room_inc_id` VALUES (2004, 1, 1543311400); INSERT INTO `ss_room_inc_id` VALUES (2005, 2, 1543311416); INSERT INTO `ss_room_inc_id` VALUES (2006, 1, 1543311514); INSERT INTO `ss_room_inc_id` VALUES (2007, 1, 1543311514); INSERT INTO `ss_room_inc_id` VALUES (2008, 2, 1543311526); INSERT INTO `ss_room_inc_id` VALUES (2009, 1, 1543311651); INSERT INTO `ss_room_inc_id` VALUES (2010, 1, 1543311651); INSERT INTO `ss_room_inc_id` VALUES (2011, 2, 1543311661); INSERT INTO `ss_room_inc_id` VALUES (2012, 2, 1543311716); INSERT INTO `ss_room_inc_id` VALUES (2013, 2, 1543311718); INSERT INTO `ss_room_inc_id` VALUES (2014, 2, 1543311787); INSERT INTO `ss_room_inc_id` VALUES (2015, 1, 1543312046); INSERT INTO `ss_room_inc_id` VALUES (2016, 1, 1543312046); INSERT INTO `ss_room_inc_id` VALUES (2017, 1, 1543312119); INSERT INTO `ss_room_inc_id` VALUES (2018, 1, 1543312119); INSERT INTO `ss_room_inc_id` VALUES (2019, 1, 1543312257); INSERT INTO `ss_room_inc_id` VALUES (2020, 1, 1543312257); INSERT INTO `ss_room_inc_id` VALUES (2021, 1, 1543312319); INSERT INTO `ss_room_inc_id` VALUES (2022, 1, 1543312319); INSERT INTO `ss_room_inc_id` VALUES (2023, 1, 1543312498); INSERT INTO `ss_room_inc_id` VALUES (2024, 1, 1543312498); INSERT INTO `ss_room_inc_id` VALUES (2025, 1, 1543312561); INSERT INTO `ss_room_inc_id` VALUES (2026, 1, 1543312561); INSERT INTO `ss_room_inc_id` VALUES (2027, 1, 1543312622); INSERT INTO `ss_room_inc_id` VALUES (2028, 1, 1543312622); INSERT INTO `ss_room_inc_id` VALUES (2029, 1, 1543312761); INSERT INTO `ss_room_inc_id` VALUES (2030, 1, 1543312761); INSERT INTO `ss_room_inc_id` VALUES (2031, 1, 1543312920); INSERT INTO `ss_room_inc_id` VALUES (2032, 1, 1543312920); INSERT INTO `ss_room_inc_id` VALUES (2033, 1, 1543313082); INSERT INTO `ss_room_inc_id` VALUES (2034, 1, 1543313082); INSERT INTO `ss_room_inc_id` VALUES (2035, 1, 1543313189); INSERT INTO `ss_room_inc_id` VALUES (2036, 1, 1543313189); INSERT INTO `ss_room_inc_id` VALUES (2037, 1, 1543313720); INSERT INTO `ss_room_inc_id` VALUES (2038, 1, 1543313720); INSERT INTO `ss_room_inc_id` VALUES (2039, 1, 1543313906); INSERT INTO `ss_room_inc_id` VALUES (2040, 1, 1543313906); INSERT INTO `ss_room_inc_id` VALUES (2041, 1, 1543314357); INSERT INTO `ss_room_inc_id` VALUES (2042, 1, 1543314357); INSERT INTO `ss_room_inc_id` VALUES (2043, 1, 1543314600); INSERT INTO `ss_room_inc_id` VALUES (2044, 1, 1543314600); INSERT INTO `ss_room_inc_id` VALUES (2045, 1, 1543314977); INSERT INTO `ss_room_inc_id` VALUES (2046, 1, 1543314977); INSERT INTO `ss_room_inc_id` VALUES (2047, 1, 1543315498); INSERT INTO `ss_room_inc_id` VALUES (2048, 1, 1543315498); INSERT INTO `ss_room_inc_id` VALUES (2049, 1, 1543315563); INSERT INTO `ss_room_inc_id` VALUES (2050, 1, 1543315563); INSERT INTO `ss_room_inc_id` VALUES (2051, 1, 1543315604); INSERT INTO `ss_room_inc_id` VALUES (2052, 1, 1543315604); INSERT INTO `ss_room_inc_id` VALUES (2053, 1, 1543315678); INSERT INTO `ss_room_inc_id` VALUES (2054, 1, 1543315678); INSERT INTO `ss_room_inc_id` VALUES (2055, 1, 1543316230); INSERT INTO `ss_room_inc_id` VALUES (2056, 1, 1543316230); INSERT INTO `ss_room_inc_id` VALUES (2057, 1, 1543316396); INSERT INTO `ss_room_inc_id` VALUES (2058, 1, 1543316396); INSERT INTO `ss_room_inc_id` VALUES (2059, 1, 1543318165); INSERT INTO `ss_room_inc_id` VALUES (2060, 1, 1543318165); INSERT INTO `ss_room_inc_id` VALUES (2061, 1, 1543318189); INSERT INTO `ss_room_inc_id` VALUES (2062, 1, 1543318189); INSERT INTO `ss_room_inc_id` VALUES (2063, 1, 1543318237); INSERT INTO `ss_room_inc_id` VALUES (2064, 1, 1543318237);

使用SQL,如果值不相等,我如何更新一列的字段值以匹配不同列的字段值?

<div class="post-text" itemprop="text"> <p>Using the example table below, as of now I have: <code>UPDATE wc_bidsys_picklist SET vipplays = 'YES' WHERE playoftheday = 'YES';</code><br> Is this much correct? If so how can I also add: "within a specific range that is set by the column (game_date) field values?" Range between '2016-06-29 00:00:00' through '2017-06-29 00:00:00'. Is this even possible? <br><br> My specific question in detail: (partially answered above)<br> Using my example below for a table called 'wc_bidsys_picklist': Using SQL is there a way to update the value ('NO' to 'YES') of each field in a specific column (vipplays) only if it does NOT equal the field of a different specific column (playoftheday) so the fields in both of these columns end up having matching values ('YES') while within a specific range set by a 3rd column (game_date)?<br></p> <p>In more simple terms I need to say "In column (game_date) from '2016-06-29 00:00:00' through '2017-06-29 00:00:00' if the field value in the column (playoftheday) = 'YES' and the field value in the column (vipplays) = 'NO' then UPDATE the field value in the column (vipplays) to 'YES'. How, if possible, can this be written in SQL? <br><br> <strong>UPDATE</strong>: After a few updates to the fiddle this one seems to work.<br> My fiddle: <a href="http://sqlfiddle.com/#!9/69cf4/1/0" rel="nofollow noreferrer">http://sqlfiddle.com/#!9/69cf4/1/0</a></p> <pre><code>CREATE TABLE wc_bidsys_picklist (`id` int, `game_date` datetime, `playoftheday` varchar(5), `vipplays` varchar(5)) ; INSERT INTO wc_bidsys_picklist (`id`, `game_date`, `playoftheday`, `vipplays`) VALUES (1, '2016-07-01 00:00:00', 'YES', 'NO'), (2, '2016-07-03 00:00:00', 'YES', 'YES'), (3, '2016-07-04 00:00:00', 'YES', 'NO'), (4, '2016-07-04 00:00:00', 'YES', 'NO'), (5, '2016-07-06 00:00:00', 'YES', 'NO'), (6, '2016-07-07 00:00:00', 'YES', 'YES'), (7, '2017-06-08 00:00:00', 'YES', 'NO'), (8, '2017-06-29 00:00:00', 'YES', 'NO') ; UPDATE wc_bidsys_picklist SET vipplays = 'YES' WHERE playoftheday = 'YES' AND (game_date BETWEEN '2016-07-01 00:00:00' AND '2017-06-29 00:00:00'); </code></pre> <p><br> On a side note I would like to reiterate that I am relatively new to this community and programming. I don't understand why all the immediate down votes. It seems like members are more interested in correcting posts and bullying new users rather than helping you out. And apparently I'm not the only one: <a href="https://hackernoon.com/the-decline-of-stack-overflow-7cb69faa575d" rel="nofollow noreferrer">https://hackernoon.com/the-decline-of-stack-overflow-7cb69faa575d</a> It's an interesting read. </p> </div>

存储过程创建临时表(表名是动态的),游标中使用了这一个临时表

ALTER PROCEDURE [dbo].[P_GetBusLocation] @Date1 datetime AS BEGIN SET NOCOUNT ON; declare @VehicleNo nvarchar(50),@VGroupID int,@RouteNumber varchar(200),@TableName varchar(50),@VehicleID bigint , @OldVehicleID bigint,@SqlStr1 varchar(1024),@SqlStr2 varchar(1024),@TemTableName varchar(50),@SqlStr3 varchar(1024) set @TableName = 'gps005' + CONVERT(varchar(20), @Date1, 112) set @TemTableName = '#Tem' + @TableName set @SqlStr1 = 'create Table ' + @TemTableName+'(GpsDateTime datetime,VehicleID bigint,VehicleNo nvarchar(50),RouteNumber varchar(200),Flag tinyint ,Longitude decimal(9,6),Latitude decimal(8,6),Speed decimal(4,1),Direction smallint,Mileage bigint ,Position varchar(200),AvgSpeed decimal(4,1),StorageTime datetime)' exec(@SqlStr1) set @SqlStr2 = 'insert into '+@TemTableName+' select t1.GpsDateTime,t1.VehicleID,null,null,t1.Flag ,t1.Longitude,t1.Latitude,t1.Speed,t1.Direction,t1.Mileage,t1.Position,t1.AvgSpeed,t1.StorageTime from '+@TableName +' as t1' exec(@SqlStr2) set @OldVehicleID = 0 set @SqlStr3 = 'declare myCursor cursor FORWARD_ONLY STATIC for select VehicleID from '+@TemTableName exec(@SqlStr3) open myCursor fetch next from myCursor into @VehicleID while(@@FETCH_STATUS = 0) begin if(@VehicleID != @OldVehicleID) begin select @VGroupID = VGroupID,@VehicleNo = VehicleLic from VehicleInfo where VehicleID = @VehicleID select @RouteNumber = RouteNumber FROM RouteInfo where VGroupID = @VGroupID exec('update '+@TemTableName+' set VehicleNo = '+@VehicleNo+',RouteNumber = '+@RouteNumber+' where VehicleID = '+@VehicleID) set @OldVehicleID = @VehicleID end fetch next from myCursor into @VehicleID end exec('select * from '+ @TemTableName) close myCursor deallocate myCursor END 入参是:2013-8-8 下面是报错: 消息 208,级别 16,状态 0,第 1 行 对象名 '#Temgps00520130808' 无效。 消息 208,级别 16,状态 0,第 1 行 对象名 '#Temgps00520130808' 无效。 消息 16916,级别 16,状态 1,过程 P_GetBusLocation,第 35 行 名为 'myCursor' 的游标不存在。 消息 16916,级别 16,状态 1,过程 P_GetBusLocation,第 38 行 名为 'myCursor' 的游标不存在。 消息 28102,级别 16,状态 1,过程 P_GetBusLocation,第 39 行 批处理执行由于调试器请求而终止。

根据时间戳分页排序问题

我们现在有一张消息表 t_message,字段有 id(int),content(varchar),user_id(int),gtm_create(timestamp)。 我们这边是按照时间戳gmt_create来排序分页的. 语句如下: 第一页的sql: select * from t_message order by gmt_create DESC limit 20; 第二页的sql: select * from t_message where gmt_create<'第一页最后一条消息的时间戳' order by gmt_create DESC limit 20; 但是现在出现了一个问题,我们现在群发了40条消息,**时间戳都是相同的** 导致我们分页查询的时候第一页是正常的,直到第二页的时候其余20条数据就丢了。 我目前只能想到的办法就是对创建消息丢进消息队列里,一条一条的排队处理,这样有消息的时间戳就能保证不一样了!! 各位大佬还有什么好的解决办法呢??

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

springboot+jwt实现token登陆权限认证

一 前言 此篇文章的内容也是学习不久,终于到周末有时间码一篇文章分享知识追寻者的粉丝们,学完本篇文章,读者将对token类的登陆认证流程有个全面的了解,可以动态搭建自己的登陆认证过程;对小项目而已是个轻量级的认证机制,符合开发需求;更多精彩原创内容关注公主号知识追寻者,读者的肯定,就是对作者的创作的最大支持; 二 jwt实现登陆认证流程 用户使用账号和面发出post请求 服务器接受到请求后使用私...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

早上躺尸,晚上干活:硅谷科技公司这么流行迟到?

硅谷科技公司上班时间OPEN早已不是什么新鲜事,早九晚五是常态,但有很多企业由于不打卡,员工们10点、11点才“姗姗来迟”的情况也屡见不鲜。 这种灵活的考勤制度为人羡慕,甚至近年来,国内某些互联网企业也纷纷效仿。不过,硅谷普遍弹性的上班制度是怎么由来的呢?这种“流行性迟到”真的有那么轻松、悠哉吗? 《动态规划专题班》 课程试听内容: 动态规划的解题要领 动态规划三大类 求最值/计数/可行性 常...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大胆预测下未来5年的Web开发

在2019年的ReactiveConf 上,《Elm in Action》的作者Richard Feldman对未来5年Web开发的发展做了预测,很有意思,分享给大家。如果你有机会从头...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

C 语言编程 — 堆栈与内存管理

目录 文章目录目录前文列表堆、栈内存管理动态分配内存重新调整内存的大小和释放内存 前文列表 《程序编译流程与 GCC 编译器》 《C 语言编程 — 基本语法》 《C 语言编程 — 基本数据类型》 《C 语言编程 — 变量与常量》 《C 语言编程 — 运算符》 《C 语言编程 — 逻辑控制语句》 《C 语言编程 — 函数》 《C 语言编程 — 高级数据类型 — 指针》 《C 语言编程 — 高级数据类...

实时更新:计算机编程语言排行榜—TIOBE世界编程语言排行榜(2020年6月份最新版)

内容导航: 1、TIOBE排行榜 2、总榜(2020年6月份) 3、本月前三名 3.1、C 3.2、Java 3.3、Python 4、学习路线图 5、参考地址 1、TIOBE排行榜 TIOBE排行榜是根据全世界互联网上有经验的程序员、课程和第三方厂商的数量,并使用搜索引擎(如Google、Bing、Yahoo!)以及Wikipedia、Amazon、YouTube统计出排名数据。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

立即提问
相关内容推荐